Event.mousePosition
Declaration
public Vector2 mousePosition;Описание
Положение мыши.
Используется в событиях EventType.MouseMove и EventType.MouseDrag. Верхний левый окно возвращает (0, 0). Нижний правый возвращает (Screen.width, Screen.height).
Дополнительные ресурсы: Event.delta.
using UnityEngine; using System.Collections;
// print the mousePosition every 10th of a second
public class ExampleClass : MonoBehaviour { private float range = 0.0f;
void OnGUI() { range = range + Time.deltaTime;
if (range > 0.1f) { Event e = Event.current; Debug.Log(e.mousePosition); range = 0.0f; } } }