Unity Button动态添加持久化监听

//UnityEvent editEvent = new UnityEvent();
UnityAction editDelegate = System.Delegate.CreateDelegate(typeof(UnityAction), anchorController.gameObject, "SetActive") as UnityAction;
//UnityEventTools.AddBoolPersistentListener(editEvent, editDelegate, true);
UnityEventTools.AddBoolPersistentListener(btn.onClick, editDelegate, true);

//UnityEvent editEvent = new UnityEvent();
UnityAction editDelegate = System.Delegate.CreateDelegate(typeof(UnityAction), anchorController.gameObject, "SetActive") as UnityAction;
//UnityEventTools.AddBoolPersistentListener(editEvent, editDelegate, true);
UnityEventTools.AddBoolPersistentListener(btn.onClick, editDelegate, true);

你可能感兴趣的:(Unity,UGUI,unity)