/// <summary>
        /// Registers a new global event.
        /// </summary>
        /// <param name="eventName">The name of the event.</param>
        /// <param name="invokableAction">The invokableAction to call when the event executes.</param>
        private static void RegisterEvent(string eventName, InvokableActionBase invokableAction)
        {
            List <InvokableActionBase> actionList;

            if (s_GlobalEventTable.TryGetValue(eventName, out actionList))
            {
#if UNITY_EDITOR
                for (int i = 0; i < actionList.Count; ++i)
                {
                    if (actionList[i].GetDelegate() == invokableAction.GetDelegate())
                    {
                        Debug.LogWarning("Warning: the function \"" + invokableAction.GetDelegate().Method.ToString() +
                                         "\" is trying to subscribe to the " + eventName + " more than once." + invokableAction.GetDelegate().Target);
                        break;
                    }
                }
#endif
                actionList.Add(invokableAction);
            }
            else
            {
                actionList = new List <InvokableActionBase>();
                actionList.Add(invokableAction);
                s_GlobalEventTable.Add(eventName, actionList);
            }
        }
        /// <summary>
        /// Registers a new event.
        /// </summary>
        /// <param name="obj">The target object.</param>
        /// <param name="eventName">The name of the event.</param>
        /// <param name="invokableAction">The invokableAction to call when the event executes.</param>
        private static void RegisterEvent(object obj, string eventName, InvokableActionBase invokableAction)
        {
#if UNITY_EDITOR
            if (obj == null)
            {
                Debug.LogError("EventHandler.RegisterEvent error: target object cannot be null.");
                return;
            }
#endif

            Dictionary <string, List <InvokableActionBase> > handlers;
            if (!s_EventTable.TryGetValue(obj, out handlers))
            {
                handlers = new Dictionary <string, List <InvokableActionBase> >();
                s_EventTable.Add(obj, handlers);
            }

            List <InvokableActionBase> actionList;
            if (handlers.TryGetValue(eventName, out actionList))
            {
#if UNITY_EDITOR
                for (int i = 0; i < actionList.Count; ++i)
                {
                    if (actionList[i].GetDelegate() == invokableAction.GetDelegate())
                    {
                        Debug.LogWarning("Warning: the function \"" + invokableAction.GetDelegate().Method.ToString() +
                                         "\" is trying to subscribe to the " + eventName + " on the " + obj + " object more than once.");
                        break;
                    }
                }
#endif
                actionList.Add(invokableAction);
            }
            else
            {
                actionList = new List <InvokableActionBase>();
                actionList.Add(invokableAction);
                handlers.Add(eventName, actionList);
            }
        }