private void OnDestroy() { AbortButton.onClick.RemoveListener(abortAction); GotItButton.onClick.RemoveListener(nextAction); StartShowAgainToggle.onValueChanged.RemoveListener(showAgainToggleAction); EndShowAgainToggle.onValueChanged.RemoveListener(showAgainToggleAction); FirstEmployeeHired.RemoveListener(firstEmployeeHiredAction); FirstMissionAccepted.RemoveListener(firstMissionAcceptedAction); FirstMissionSelected.RemoveListener(firstMissionSelectedAction); WorkplaceInfoOpened.RemoveListener(workplaceInfoOpenedAction); FirstLevelUp.RemoveListener(firstLevelUpAction); }
public static void StopListening(string eventName, UnityAction <object> listener) { if (eventManager == null) { return; } ObjectEvent thisEvent = null; if (instance.objectEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
/*! Stop calling the function listener. * This should be called with the exact same parameters as were passed to startListening before.*/ public static void stopListening(Event eventType, UnityAction <object> listener) { if (mInstance == null) { return; } ObjectEvent thisEvent = null; // Attempt to get the the UnityEvent from the dictionary. If this succeeds, // thisEvent will be filled and the if will evaluate to true: if (instance.mEventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.RemoveListener(listener); } //Debug.Log("Removed event listener for event: " + eventType); }