using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using TDTK;
namespace TDTK{
public class UIUtilities : MonoBehaviour {
//inputID=-1 - mouse cursor, inputID>=0 - touch finger index
public static bool IsCursorOnUI(int inputID=-1){
EventSystem eventSystem = EventSystem.current;
return ( eventSystem.IsPointerOverGameObject( inputID ) );
}
}
}
在其它类中,可以很轻松的判断鼠标当前是否停留在UI上
在UI上,则返回True,否则返回False
FR:海涛高软(QQ群:386476712)