public void StartListening(string eventName, UnityAction <object> listener) { GeneralEvent thisEvent = null; if (eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new GeneralEvent(); thisEvent.AddListener(listener); eventDictionary.Add(eventName, thisEvent); } }
public static void StartListening(int eventName, UnityAction <GeneralData> listener) { GeneralEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new GeneralEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } }