Exemplo n.º 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/"))
     {
         StandardRoughnessShaderGUI.SetupMaterialWithBlendMode(material, (StandardRoughnessShaderGUI.BlendMode)material.GetFloat("_Mode"));
     }
     else
     {
         StandardRoughnessShaderGUI.BlendMode blendMode = StandardRoughnessShaderGUI.BlendMode.Opaque;
         if (oldShader.name.Contains("/Transparent/Cutout/"))
         {
             blendMode = StandardRoughnessShaderGUI.BlendMode.Cutout;
         }
         else if (oldShader.name.Contains("/Transparent/"))
         {
             blendMode = StandardRoughnessShaderGUI.BlendMode.Fade;
         }
         material.SetFloat("_Mode", (float)blendMode);
         StandardRoughnessShaderGUI.MaterialChanged(material);
     }
 }
Exemplo n.º 2
0
 private static void MaterialChanged(Material material)
 {
     StandardRoughnessShaderGUI.SetupMaterialWithBlendMode(material, (StandardRoughnessShaderGUI.BlendMode)material.GetFloat("_Mode"));
     StandardRoughnessShaderGUI.SetMaterialKeywords(material);
 }