U3d:eventertrigger的使用
public class Test3 : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void OnPointerEnter(PointerEventData eventData) { print(eventData.clickTime+"enter"); } public void OnPointerExit(PointerEventData eventData) { //throw new NotImplementedException(); print(eventData.button+"exit"); } }
直接继承对应的接口即可