public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader) { if (newShader.name.Contains("Unlit")) { material.SetFloat("_LightingEnabled", 0f); } else { material.SetFloat("_LightingEnabled", 1f); } if (material.HasProperty("_Emission")) { material.SetColor("_EmissionColor", material.GetColor("_Emission")); } base.AssignNewShaderToMaterial(material, oldShader, newShader); if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/")) { StandardParticlesShaderGUI.SetupMaterialWithBlendMode(material, (StandardParticlesShaderGUI.BlendMode)material.GetFloat("_Mode")); } else { StandardParticlesShaderGUI.BlendMode blendMode = StandardParticlesShaderGUI.BlendMode.Opaque; if (oldShader.name.Contains("/Transparent/Cutout/")) { blendMode = StandardParticlesShaderGUI.BlendMode.Cutout; } else if (oldShader.name.Contains("/Transparent/")) { blendMode = StandardParticlesShaderGUI.BlendMode.Fade; } material.SetFloat("_Mode", (float)blendMode); this.MaterialChanged(material); } }
private void MaterialChanged(Material material) { StandardParticlesShaderGUI.SetupMaterialWithBlendMode(material, (StandardParticlesShaderGUI.BlendMode)material.GetFloat("_Mode")); if (this.colorMode != null) { StandardParticlesShaderGUI.SetupMaterialWithColorMode(material, (StandardParticlesShaderGUI.ColorMode)material.GetFloat("_ColorMode")); } this.SetMaterialKeywords(material); }