public static void SetupInput()
        {
            _eventHandlers = new List <KeyValuePair <EventHandlerAttribute, Delegate> > ();
            MenuItems      = new List <KeyValuePair <MenuItemAttribute, Delegate> > ();
            var scriptAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where((Assembly assembly) => assembly.FullName.Contains("Assembly"));

            foreach (var assembly in scriptAssemblies)
            {
                foreach (var type in assembly.GetTypes())
                {
                    foreach (var method in type.GetMethods(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static))
                    {
                        Delegate actionDelegate = null;
                        foreach (var attr in method.GetCustomAttributes(true))
                        {
                            var attrType = attr.GetType();
                            if (attrType == typeof(EventHandlerAttribute))
                            {
                                if (EventHandlerAttribute.AssureValidity(method, attr as EventHandlerAttribute))
                                {
                                    if (actionDelegate == null)
                                    {
                                        actionDelegate = Delegate.CreateDelegate(typeof(Action <Event>), method);
                                    }
                                    _eventHandlers.Add(new KeyValuePair <EventHandlerAttribute, Delegate>(attr as EventHandlerAttribute, actionDelegate));
                                }
                            }
                            if (attrType == typeof(MenuItemAttribute))
                            {
                                if (actionDelegate == null)
                                {
                                    actionDelegate = Delegate.CreateDelegate(typeof(Action), method);
                                }
                                MenuItems.Add(new KeyValuePair <MenuItemAttribute, Delegate>(attr as MenuItemAttribute, actionDelegate));
                            }
                        }
                    }
                }
            }
            _eventHandlers.Sort((handlerA, handlerB) => handlerA.Key.Priority.CompareTo(handlerB.Key.Priority));
        }
    public static void SetupInput(List <Type> setType)
    {
        eventHandlers  = new List <KeyValuePair <EventHandlerAttribute, Delegate> >();
        hotkeyHandlers = new List <KeyValuePair <HotkeyAttribute, Delegate> >();
        contextEntries = new List <KeyValuePair <ContextEntryAttribute, MenuFunctionData> >();

        IEnumerable <Assembly> scriptAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where((Assembly assembly) => assembly.FullName.Contains("Assembly"));

        foreach (Assembly assembly in scriptAssemblies)
        {
            foreach (Type type in assembly.GetTypes())
            {
                bool getType = false;
                foreach (var t in setType)
                {
                    if (type == t || type == typeof(EditorState))
                    {
                        getType = true;
                        break;
                    }
                }

                if (!getType)
                {
                    continue;
                }

                foreach (MethodInfo method in type.GetMethods(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static))
                {
                    Delegate actionDelegate = null;
                    foreach (object attr in method.GetCustomAttributes(true))
                    {
                        Type attrType = attr.GetType();
                        if (attrType == typeof(EventHandlerAttribute))
                        {
                            if (EventHandlerAttribute.AssureValidity(method, attr as EventHandlerAttribute))
                            {
                                if (actionDelegate == null)
                                {
                                    actionDelegate = Delegate.CreateDelegate(typeof(Action <EditorInputInfo>), method);
                                }

                                eventHandlers.Add(new KeyValuePair <EventHandlerAttribute, Delegate>(attr as EventHandlerAttribute, actionDelegate));
                            }
                        }
                        else if (attrType == typeof(HotkeyAttribute))
                        {
                            if (HotkeyAttribute.AssureValidity(method, attr as HotkeyAttribute))
                            {
                                if (actionDelegate == null)
                                {
                                    actionDelegate = Delegate.CreateDelegate(typeof(Action <EditorInputInfo>), method);
                                }
                                hotkeyHandlers.Add(new KeyValuePair <HotkeyAttribute, Delegate>(attr as HotkeyAttribute, actionDelegate));
                            }
                        }
                        else if (attrType == typeof(ContextEntryAttribute))
                        {
                            if (ContextEntryAttribute.AssureValidity(method, attr as ContextEntryAttribute))
                            {
                                if (actionDelegate == null)
                                {
                                    actionDelegate = Delegate.CreateDelegate(typeof(Action <EditorInputInfo>), method);
                                }

                                MenuFunctionData menuFunction = (object callbackObj) =>
                                {
                                    if (!(callbackObj is EditorInputInfo))
                                    {
                                        throw new UnityException("Callback Object passed by context is not of type EditorMenuCallback!");
                                    }
                                    actionDelegate.DynamicInvoke(callbackObj as EditorInputInfo);
                                };
                                contextEntries.Add(new KeyValuePair <ContextEntryAttribute, MenuFunctionData>(attr as ContextEntryAttribute, menuFunction));
                            }
                        }
                    }
                }
            }
        }

        eventHandlers.Sort((handlerA, handlerB) => handlerA.Key.priority.CompareTo(handlerB.Key.priority));
        hotkeyHandlers.Sort((handlerA, handlerB) => handlerA.Key.priority.CompareTo(handlerB.Key.priority));
    }