Version: 2021.3
언어: 한국어

Event.mousePosition

매뉴얼로 전환
public Vector2 mousePosition ;

설명

The mouse position.

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; } } }