📜  如何修复 Input.GetMouseButtonDown(0) conting as ui - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:18.230000             🧑  作者: Mango

代码示例1
using UnityEngine.EventSystems;

void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
         // This line prevents the Code from activating UI
         if (EventSystem.current.IsPointerOverGameObject())
                return;
         // Put your code here       
    }
}