UnityEditor.MaterialEditor.ColorProperty C# (CSharp) Method

ColorProperty() public method

public ColorProperty ( MaterialProperty prop, string label ) : Color
prop MaterialProperty
label string
return Color
        public Color ColorProperty(MaterialProperty prop, string label)
        {
            Rect position = this.GetPropertyRect(prop, label, true);
            return this.ColorProperty(position, prop, label);
        }

Same methods

MaterialEditor::ColorProperty ( Rect position, MaterialProperty prop, string label ) : Color
MaterialEditor::ColorProperty ( string propertyName, string label ) : Color

Usage Example

示例#1
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;             // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                m_MaterialEditor.ShaderProperty(heightFogStart, Styles.heightFogStart.text);
                m_MaterialEditor.ShaderProperty(heightFogEnd, Styles.heightFogEnd.text);
                //m_MaterialEditor.ShaderProperty (heightFogColor, Styles.heightFogColor.text);
                m_MaterialEditor.ColorProperty(heightFogColor, Styles.heightFogColor.text);


                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
All Usage Examples Of UnityEditor.MaterialEditor::ColorProperty
MaterialEditor