UnityEditor.MaterialEditor.TexturePropertySingleLine C# (CSharp) Method

TexturePropertySingleLine() public method

public TexturePropertySingleLine ( GUIContent label, MaterialProperty textureProp ) : Rect
label UnityEngine.GUIContent
textureProp MaterialProperty
return UnityEngine.Rect
        public Rect TexturePropertySingleLine(GUIContent label, MaterialProperty textureProp)
        {
            return this.TexturePropertySingleLine(label, textureProp, null, null);
        }

Same methods

MaterialEditor::TexturePropertySingleLine ( GUIContent label, MaterialProperty textureProp, MaterialProperty extraProperty1 ) : Rect
MaterialEditor::TexturePropertySingleLine ( GUIContent label, MaterialProperty textureProp, MaterialProperty extraProperty1, MaterialProperty extraProperty2 ) : Rect

Usage Example

        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            // albedo
            materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);

            // metallic / smoothness
            if (_metallicGlossMap.textureValue == null)
                materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
            else
                materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);

            // normal map
            materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);

            // occlusion
            materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);

            // emission
            bool hadEmissionTexture = _emissionMap.textureValue != null;
            materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);

            // if texture was assigned and color was black set color to white
            if (_emissionMap.textureValue != null && !hadEmissionTexture)
                if (_emissionColor.colorValue.maxColorComponent <= 0)
                    _emissionColor.colorValue = Color.white;

            return EditorGUI.EndChangeCheck();
        }
All Usage Examples Of UnityEditor.MaterialEditor::TexturePropertySingleLine
MaterialEditor