using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class UiClickTest : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0)) {
if (EventSystem.current.IsPointerOverGameObject()) {
Debug.Log("点击到UGUI的UI界面,会返回true");
} else {
Debug.Log("如果没点击到UGUI上的任何东西,就会返回false");
}
}
}
}
网友评论