Example #1
0
        public override void OnEnable()
        {
            base.OnEnable();

            if (target != null)
            {
                //Grab our properties
                shape  = serializedObject.FindProperty("shape");
                normal = serializedObject.FindProperty("normal");

                //Initialize our property drawers
                if (propertyGroups == null || propertyGroups.Length != 2)
                {
                    propertyGroups = new PropertyGroupDrawer[2];
                }
                if (propertyGroups[0] == null)
                {
                    propertyGroups[0] = new ShapeTextureDrawer(new GUIContent("Shape"), shape, transparencyType, cutoff, this);
                }
                if (propertyGroups[1] == null)
                {
                    propertyGroups[1] = new NormalTextureDrawer(new GUIContent("Normal"), normal, this);
                }

                //Initialize property groups
                if (propertyGroups != null)
                {
                    for (int i = 0; i < propertyGroups.Length; i++)
                    {
                        propertyGroups[i].Initialize();
                    }
                }
            }
        }
Example #2
0
        public override void OnEnable()
        {
            base.OnEnable();

            if (target != null)
            {
                //Grab our properties
                albedo   = serializedObject.FindProperty("albedo");
                specular = serializedObject.FindProperty("specular");
                normal   = serializedObject.FindProperty("normal");
                emissive = serializedObject.FindProperty("emissive");

                //Initialize our property drawers
                if (propertyGroups == null || propertyGroups.Length != 4)
                {
                    propertyGroups = new PropertyGroupDrawer[4];
                }
                if (propertyGroups[0] == null)
                {
                    propertyGroups[0] = new AlbedoTextureDrawer(new GUIContent("Albedo"), albedo, transparencyType, cutoff, this);
                }
                if (propertyGroups[1] == null)
                {
                    propertyGroups[1] = new SpecularTextureDrawer(new GUIContent("Gloss"), specular, this);
                }
                if (propertyGroups[2] == null)
                {
                    propertyGroups[2] = new NormalTextureDrawer(new GUIContent("Normal"), normal, this);
                }
                if (propertyGroups[3] == null)
                {
                    propertyGroups[3] = new EmissiveTextureDrawer(new GUIContent("Emissive"), emissive, this);
                }

                //Initialize property groups
                if (propertyGroups != null)
                {
                    for (int i = 0; i < propertyGroups.Length; i++)
                    {
                        propertyGroups[i].Initialize();
                    }
                }
            }
        }