only preserve render queue and override tag if it differs from the shader's one (so we dont fuck up dummy shaders, which dont have those things set)

This commit is contained in:
JohnCorby 2022-12-02 13:44:37 -08:00
parent d40eff9dcf
commit bd6aca5c88

View File

@ -29,11 +29,14 @@ public static class ShaderReplacer
// preserve override tag and render queue (for Standard shader) // preserve override tag and render queue (for Standard shader)
// keywords and properties are already preserved // keywords and properties are already preserved
var renderType = material.GetTag("RenderType", false); if (material.renderQueue != material.shader.renderQueue)
var renderQueue = material.renderQueue; {
material.shader = replacementShader; var renderType = material.GetTag("RenderType", false);
material.SetOverrideTag("RenderType", renderType); var renderQueue = material.renderQueue;
material.renderQueue = renderQueue; material.shader = replacementShader;
material.SetOverrideTag("RenderType", renderType);
material.renderQueue = renderQueue;
}
} }
} }
} }