public void RebuildIntructionsInChildren()
        {
            DisposeChildren();
            AddComponentMenuItem[] values;
            if (activeItem == null)
            {
                values = AddComponentMenuItems.GetFiltered(FilterString);
            }
            else
            {
                values = activeItem.children;
            }

            int count = values.Length;

            DrawerArrayPool.Resize(ref members, count);

            for (int n = 0; n < count; n++)
            {
                members[n] = AddComponentMenuItemDrawer.Create(values[n]);
            }
            UpdateContentRect();

            SetScrollPos(0f, false);
            SetSelectedMember(0, false);
            UpdateVisibleMembers();
        }
Exemplo n.º 2
0
        private static void BuildConflictingTypesDictionary()
        {
            invalidComponentTypes = TypeExtensions.InvalidComponentTypes;

            conflictingTypes = new Dictionary <Type, Type[]>(20);

            onlyComponentTypes = new HashSet <Type>();

            AddConflictPair(Types.MeshFilter, Types.TextMesh);

            AddConflictPair(Types.Rigidbody, Types.Rigidbody2D);
            AddConflictPair(Types.Rigidbody, Types.Collider2D);
            AddConflictPair(Types.Rigidbody, Types.Joint2D);
            AddConflictPair(Types.Rigidbody, Types.Effector2D);
            AddConflictPair(Types.Rigidbody, Types.PhysicsUpdateBehaviour2D);

            AddConflictPair(Types.Collider, Types.Rigidbody2D);
            AddConflictPair(Types.Collider, Types.Collider2D);
            AddConflictPair(Types.Collider, Types.Joint2D);
            AddConflictPair(Types.Collider, Types.Effector2D);
            AddConflictPair(Types.Collider, Types.PhysicsUpdateBehaviour2D);

            AddConflictPair(Types.ConstantForce, Types.Rigidbody2D);
            AddConflictPair(Types.ConstantForce, Types.Collider2D);
            AddConflictPair(Types.ConstantForce, Types.Joint2D);
            AddConflictPair(Types.ConstantForce, Types.Effector2D);
            AddConflictPair(Types.ConstantForce, Types.PhysicsUpdateBehaviour2D);

            AddDisallowMultiple(Types.AudioListener);
            AddDisallowMultiple(Types.Camera);
            AddDisallowMultiple(Types.FlareLayer);
            AddDisallowMultiple(Types.MeshFilter);
            AddDisallowMultiple(Types.MeshRenderer);
            AddDisallowMultiple(Types.ParticleSystem);
            AddDisallowMultiple(Types.Rigidbody);
            AddDisallowMultiple(Types.Rigidbody2D);
            AddDisallowMultiple(Types.SkinnedMeshRenderer);
            AddDisallowMultiple(Types.TextMesh);
            AddDisallowMultiple(Types.TrailRenderer);
            AddDisallowMultiple(Types.Light);

            // AddComponentMenuItems.Setup handles DisallowMultipleComponent attributes
            // so it also needs to be run before the conflicting types dictionary is
            // fully popuplated
            AddComponentMenuItems.Setup();
        }
Exemplo n.º 3
0
        private static void Build(ComponentCategory[] addCategories, bool alsoAddFromComponentMenuItems)
        {
            dictionaryBuilt = true;

            for (int n = 0, count = addCategories.Length; n < count; n++)
            {
                var addCategory = addCategories[n];
                var types       = addCategory.components;
                for (int t = 0, typeCount = types.Length; t < typeCount; t++)
                {
                    categoriesByComponent[types[t]] = addCategory.name;
                }
            }

            if (alsoAddFromComponentMenuItems)
            {
                BuildFromAddComponentMenuItems(AddComponentMenuItems.GetAll());
            }
        }