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)
// keywords and properties are already preserved
var renderType = material.GetTag("RenderType", false);
var renderQueue = material.renderQueue;
material.shader = replacementShader;
material.SetOverrideTag("RenderType", renderType);
material.renderQueue = renderQueue;
if (material.renderQueue != material.shader.renderQueue)
{
var renderType = material.GetTag("RenderType", false);
var renderQueue = material.renderQueue;
material.shader = replacementShader;
material.SetOverrideTag("RenderType", renderType);
material.renderQueue = renderQueue;
}
}
}
}