Unity3D

Unity 怎样检测UGUI被点到了

2017-03-24  本文已影响71人  U3D界金城武

一个简单Demo

if (Input.GetMouseButtonDown(0) )
        {
            Debug.Log(EventSystem.current.gameObject.name);
            if (EventSystem.current.currentSelectedGameObject)
                Debug.Log("当前触摸在UI上");
            else Debug.Log("当前没有触摸在UI上");
        }
上一篇 下一篇

猜你喜欢

热点阅读