Beispiel #1
0
 /// <summary>
 /// Start listener to an event with extra data
 /// </summary>
 /// <param name="eventName">Name of the event</param>
 /// <param name="action">Action to execute with the extra data</param>
 public static void StartListening(string eventName, UnityAction <object> action)
 {
     if (eventsWithData.TryGetValue(eventName, out UnityObjectEvent auxEvent))
     {
         auxEvent.AddListener(action);
     }
     else
     {
         auxEvent = new UnityObjectEvent();
         auxEvent.AddListener(action);
         eventsWithData.Add(eventName, auxEvent);
     }
 }