Ejemplo n.º 1
0
        private static void RegisterComponentHiddenInMenu(Type type)
        {
            if (type.IsDefined(Types.DisallowMultipleComponent, false))
            {
                AddComponentUtility.AddDisallowMultiple(type);
            }

            if (type.IsDefined(OnlyComponentAttribute, true))
            {
                AddComponentUtility.AddOnlyComponent(type);
            }
        }
Ejemplo n.º 2
0
        private static void Add(Type type, string fullMenuName)
        {
            if (type.IsDefined(Types.DisallowMultipleComponent, false))
            {
                AddComponentUtility.AddDisallowMultiple(type);
            }

            if (type.IsDefined(OnlyComponentAttribute, true))
            {
                AddComponentUtility.AddOnlyComponent(type);
            }

            int split = fullMenuName.LastIndexOf('/');

            if (split == -1)
            {
                                #if DEV_MODE
                Debug.LogWarning("Adding type " + type.Name + " with fullMenuName \"" + fullMenuName + "\" to root");
                                #endif

                GetOrCreateRootItem(fullMenuName, type);
            }
            else
            {
                var groupLabels = fullMenuName.Substring(0, split);
                var itemLabel   = fullMenuName.Substring(split + 1);

                //TEMP
                                #if DEV_MODE
                if (fullMenuName.StartsWith("Unity Engine/", StringComparison.Ordinal) || fullMenuName.StartsWith("Unity Editor/", StringComparison.Ordinal))
                {
                    Debug.LogError("Creating Group \"" + fullMenuName.Substring(13) + "\" for type " + type.FullName + " with fullMenuName \"" + fullMenuName + "\" and assembly " + type.Assembly.GetName().Name + ".");
                }
                                #endif

                var group = GetOrCreateGroup(groupLabels, null);
                group.AddChild(itemLabel, type);
                pathBuilder.Clear();
            }
        }