检测鼠标是否在UI上unity

public static bool IsCursorOnUI(int inputID=-1){
EventSystem eventSystem = EventSystem.current;
return ( eventSystem.IsPointerOverGameObject( inputID ) );
}

原文地址:https://www.cnblogs.com/mcyushao/p/9940579.html