Version: 2019.1

Event.mousePosition

Switch to Manual
public Vector2 mousePosition ;

Description

Позиция мыши.

Used in EventType.MouseMove and EventType.MouseDrag events. The top-left of the window returns (0, 0). The bottom-right returns (Screen.width, Screen.height).

See Also: 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; } } }