using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MouseBtnDown : MonoBehaviour { public GameObject MouseX; public GameObject MouseY; Text txtMX, txtMY; // Use this for initialization void Start () { txtMX = MouseX.gameObject.GetComponent(); txtMY = MouseY.gameObject.GetComponent(); } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown(0)) { Vector3 mPos = Input.mousePosition; txtMX.text = mPos.x.ToString(); txtMY.text = mPos.y.ToString(); } } }