private void CreateActionInspector(EventHandler handler)
    {
        System.Type inspectorType = GPActionInspectorManager.InspectorTypeForAction(handler.Action);

        if (inspectorType == null)
        {
            return;
        }

        m_actionInspector = (GPActionInspector)Activator.CreateInstance(inspectorType);
        m_actionInspector.TargetAction = handler.Action;
    }
    private void DisplayActionManagementField()
    {
        EventHandler handler = (EventHandler)target;

        if (handler.Action == null)
        {
            DisplayActionCreationField();
        }
        else
        {
            DisplayActionDeleteField();
        }
    }
    private void CreateAction()
    {
        if (m_actionTypeSelectedIndex >= GPActionManager.s_gpactionTypes.Length)
        {
            throw new Exception("Out of bound index");
        }

        EventHandler handler = (EventHandler)target;

        System.Type actionType = GPActionManager.s_gpactionTypes[m_actionTypeSelectedIndex];

        handler.Action = handler.AddAction(actionType);
    }
    private void DeleteAction()
    {
        EventHandler handler = (EventHandler)target;

        if (handler.Action == null)
        {
            return;
        }

        if (EditorUtility.DisplayDialog("Confirm Delete",
                                        "Are you sure you want to delete this action ? " +
                                        "This can not be undone!",
                                        "Confirm", "Cancel"))
        {
            handler.GetGPActionObjectMapperOrCreate().ResetGPActionObjectHolder(handler);
        }
    }
    public override void OnInspectorGUI()
    {
        EventHandler handler = (EventHandler)target;

        // Display Default MonoBehaviour editor

        base.OnInspectorGUI();

        // Display Handler Kind popup

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("State: " + handler.State.ToString());

        if (EditorApplication.isPlaying && GUILayout.Button("Debug Trigger"))
        {
            handler.EventTrigger(new GPEvent {
                EventID = handler._eventID
            });
        }
    }