public static void UpdateMaterial(Material material, MaterialUpdateType updateType) { // newly created materials should initialize the globalIlluminationFlags (default is off) if (updateType == MaterialUpdateType.CreatedNewMaterial) { material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; } BaseShaderGUI.UpdateMaterialSurfaceOptions(material, automaticRenderQueue: false); LitGUI.SetupSpecularWorkflowKeyword(material, out bool isSpecularWorkflow); }
// this is used to update a material's keywords, applying any shader-associated logic to update dependent properties and keywords // this is also invoked when a material is created, modified, or the material's shader is modified or reassigned internal static void UpdateMaterial(Material material, MaterialUpdateType updateType, ShaderID shaderID = ShaderID.Unknown) { // if unknown, look it up from the material's shader // NOTE: this will only work for asset-based shaders.. if (shaderID == ShaderID.Unknown) { shaderID = GetShaderID(material.shader); } switch (shaderID) { case ShaderID.Lit: LitShader.SetMaterialKeywords(material, LitGUI.SetMaterialKeywords); break; case ShaderID.SimpleLit: SimpleLitShader.SetMaterialKeywords(material, SimpleLitGUI.SetMaterialKeywords); break; case ShaderID.Unlit: UnlitShader.SetMaterialKeywords(material); break; case ShaderID.ParticlesLit: ParticlesLitShader.SetMaterialKeywords(material, LitGUI.SetMaterialKeywords, ParticleGUI.SetMaterialKeywords); break; case ShaderID.ParticlesSimpleLit: ParticlesSimpleLitShader.SetMaterialKeywords(material, SimpleLitGUI.SetMaterialKeywords, ParticleGUI.SetMaterialKeywords); break; case ShaderID.ParticlesUnlit: ParticlesUnlitShader.SetMaterialKeywords(material, null, ParticleGUI.SetMaterialKeywords); break; case ShaderID.SG_Lit: ShaderGraphLitGUI.UpdateMaterial(material, updateType); break; case ShaderID.SG_Unlit: ShaderGraphUnlitGUI.UpdateMaterial(material, updateType); break; default: break; } }
public static void UpdateMaterial(Material material, MaterialUpdateType updateType) { BaseShaderGUI.UpdateMaterialSurfaceOptions(material, automaticRenderQueue: false); }
public static void UpdateMaterial(Material material, MaterialUpdateType updateType) { bool automaticRenderQueue = GetAutomaticQueueControlSetting(material); BaseShaderGUI.UpdateMaterialSurfaceOptions(material, automaticRenderQueue); }