I’ve detected Shader duplication in Memory using the Memory Profiler. So I’ve packed the Shader in a separate bundle, all other bundles reference this bundle.
But after doing this, the its shading is incorrect. Now, I know that we’re using Runtime script to set Shader.SetGlobalColor, Shader.SetKeyword on some assets. I don’t know if this is causing the Color to be different.
It might be because you’re setting a Keyword at runtime that would produce a variant, so at build time it doesn’t know this variant is needed and gets missed out.
I struggled to make good use of the ShaderVariantCollection stuff but found that adding a dummy Material using the shader with the keyword ticked to the same Bundle as the Shader would prompt the variant to not get stripped.
There are also some issues if the shader is in a different bundle from the materials that use it.
Some good info here on the last post of this thread.
Yeah I’ve solved this by using ShaderVariantCollection. I pack the Shader and ShaderVariantCollection into the same bundle and it works. Forgot to update the post.