UnityEditor.MaterialEditor.ShaderProperty C# (CSharp) Méthode

ShaderProperty() public méthode

public ShaderProperty ( MaterialProperty prop, string label ) : void
prop MaterialProperty
label string
Résultat void
        public void ShaderProperty(MaterialProperty prop, string label)
        {
            this.ShaderProperty(prop, label, 0);
        }

Same methods

MaterialEditor::ShaderProperty ( MaterialProperty prop, string label, int labelIndent ) : void
MaterialEditor::ShaderProperty ( Rect position, MaterialProperty prop, string label ) : void
MaterialEditor::ShaderProperty ( Rect position, MaterialProperty prop, string label, int labelIndent ) : void
MaterialEditor::ShaderProperty ( Shader shader, int propertyIndex ) : void

Usage Example

   void DrawLayer(MaterialEditor editor, int i, MaterialProperty[] props, string[] keyWords, Workflow workflow, 
      bool hasGloss, bool hasSpec, bool isParallax, bool hasEmis, bool hasDistBlend)
   {
      EditorGUIUtility.labelWidth = 0f;
      var albedoMap = FindProperty ("_Tex" + i, props);
      var tint = FindProperty("_Tint" + i, props);
      var normalMap = FindProperty ("_Normal" + i, props);
      var smoothness = FindProperty("_Glossiness" + i, props);
      var glossinessMap = FindProperty("_GlossinessTex" + i, props, false);
      var metallic = FindProperty("_Metallic" + i, props, false);
      var emissionTex = FindProperty("_Emissive" + i, props);
      var emissionMult = FindProperty("_EmissiveMult" + i, props);
      var parallax = FindProperty("_Parallax" + i, props);
      var texScale = FindProperty("_TexScale" + i, props);
      var specMap = FindProperty("_SpecGlossMap" + i, props, false);
      var specColor = FindProperty("_SpecColor" + i, props, false);
      var distUVScale = FindProperty("_DistUVScale" + i, props, false);

      editor.TexturePropertySingleLine(new GUIContent("Albedo/Height"), albedoMap);
      editor.ShaderProperty(tint, "Tint");
      editor.TexturePropertySingleLine(new GUIContent("Normal"), normalMap);
      if (workflow == Workflow.Metallic)
      {
         editor.TexturePropertySingleLine(new GUIContent("Metal(R)/Smoothness(A)"), glossinessMap);
      }
      else
      {
         editor.TexturePropertySingleLine(new GUIContent("Specular(RGB)/Gloss(A)"), specMap);
      }
      if (workflow == Workflow.Metallic && !hasGloss)
      { 
         editor.ShaderProperty(smoothness, "Smoothness");
         editor.ShaderProperty(metallic, "Metallic");
      }
      else if (workflow == Workflow.Specular && !hasSpec)
      {
         editor.ShaderProperty(smoothness, "Smoothness");
         editor.ShaderProperty(specColor, "Specular Color");
      }
      editor.TexturePropertySingleLine(new GUIContent("Emission"), emissionTex);
      editor.ShaderProperty(emissionMult, "Emissive Multiplier");

      editor.ShaderProperty(texScale, "Texture Scale");
      if (hasDistBlend)
      {
         editor.ShaderProperty(distUVScale, "Distance UV Scale");
      }
      if (isParallax)
      {
         editor.ShaderProperty(parallax, "Parallax Height");
      }

      if (i != 1)
      {
         editor.ShaderProperty(FindProperty("_Contrast"+i, props), "Interpolation Contrast");
      }
   }
All Usage Examples Of UnityEditor.MaterialEditor::ShaderProperty
MaterialEditor