SetupMaterialWithBlendMode() public static method

public static SetupMaterialWithBlendMode ( Material material, BlendMode blendMode ) : void
material UnityEngine.Material
blendMode BlendMode
return void
Example #1
0
 public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
 {
     if (material.HasProperty("_Emission"))
     {
         material.SetColor("_EmissionColor", material.GetColor("_Emission"));
     }
     base.AssignNewShaderToMaterial(material, oldShader, newShader);
     if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
     {
         StandardShaderGUI.SetupMaterialWithBlendMode(material, (StandardShaderGUI.BlendMode)material.GetFloat("_Mode"));
     }
     else
     {
         StandardShaderGUI.BlendMode blendMode = StandardShaderGUI.BlendMode.Opaque;
         if (oldShader.name.Contains("/Transparent/Cutout/"))
         {
             blendMode = StandardShaderGUI.BlendMode.Cutout;
         }
         else if (oldShader.name.Contains("/Transparent/"))
         {
             blendMode = StandardShaderGUI.BlendMode.Fade;
         }
         material.SetFloat("_Mode", (float)blendMode);
         this.DetermineWorkflow(MaterialEditor.GetMaterialProperties(new Material[]
         {
             material
         }));
         StandardShaderGUI.MaterialChanged(material, this.m_WorkflowMode);
     }
 }
        private static void MaterialChanged(Material material, StandardShaderGUI.WorkflowMode workflowMode)
        {
            if (material.GetFloat("_EmissionScaleUI") < 0f)
            {
                material.SetFloat("_EmissionScaleUI", 0f);
            }
            Color color = StandardShaderGUI.EvalFinalEmissionColor(material);

            material.SetColor("_EmissionColor", color);
            StandardShaderGUI.SetupMaterialWithBlendMode(material, (StandardShaderGUI.BlendMode)material.GetFloat("_Mode"));
            StandardShaderGUI.SetMaterialKeywords(material, workflowMode);
        }
Example #3
0
 private static void MaterialChanged(Material material, StandardShaderGUI.WorkflowMode workflowMode)
 {
     StandardShaderGUI.SetupMaterialWithBlendMode(material, (StandardShaderGUI.BlendMode)material.GetFloat("_Mode"));
     StandardShaderGUI.SetMaterialKeywords(material, workflowMode);
 }