private void GetRightClickAttributedMethods()
    {
        var result = new List <RightClickAttributedComponent>();

        var allComponentTypes = AppDomain.CurrentDomain.GetAssemblies()
                                .SelectMany(s => s.GetTypes())
                                .Where(s => typeof(MonoBehaviour).IsAssignableFrom(s));

        foreach (var componentType in allComponentTypes)
        {
            var attributedMethodsForType = componentType.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.FlattenHierarchy)
                                           .Where(m => m.GetCustomAttribute <RightClickMethod>(true) != null)
                                           .ToList();
            if (attributedMethodsForType.Count > 0)
            {
                RightClickAttributedComponent component = new RightClickAttributedComponent
                {
                    ComponentType = componentType, AttributedMethods = attributedMethodsForType
                };
                result.Add(component);
            }
        }

        attributedTypes = result;
    }
 //creates sub menu items for the specified component, hooking them up the the corresponding method on the
 //actual component
 private IEnumerable <RightClickMenuItem> CreateSubMenuOptions(RightClickAttributedComponent attributedType, Component actualComponent)
 {
     return(attributedType.AttributedMethods
            .Select(m => CreateSubMenuOption(m, actualComponent)));
 }