//删除事件 public static void ClearEvents(GameObject obj) { UIEventSystem evtSystem = obj.GetComponent <UIEventSystem>(); if (evtSystem != null) { evtSystem.triggers.Clear(); } }
//添加事件组件 public static UIEventSystem Get(GameObject obj) { UIEventSystem evtSystem = obj.GetComponent <UIEventSystem>(); if (evtSystem == null) { evtSystem = obj.AddComponent <UIEventSystem>(); } return(evtSystem); }