防止UI穿透操作到游戏场景

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
if (EventSystem.current.IsPointerOverGameObject())
{
return ;
}
#else
if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))
{
if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
{
return ;
}
}
#endif

原文地址:https://www.cnblogs.com/lijian-boke/p/6070600.html