- Home /
Material.CopyPropertiesFromMaterial and the Standard Shader
The standard shader has a number of variants, and to select the appropriate one in script you need to call Material.EnableKeyword on those keywords you're planning on using.
My question? Does Material.CopyPropertiesFromMaterial perform this enabling step for you if you're copying material properties from one Standard shader material to another?
I'm really hoping it does, as that would save some manual fluffing around to copy those settings over individually.
The use case is an automated shader 'upgrader' - I have clients using older Unity assetbundles in a project that we've recently upgraded to take advantage of single-pass rendering in VR. However, the shaders as compiled on those original asset bundles don't included the required additional properties to take advantage of single-pass rendering - so they end up rendering very badly.
By creating new copies of all standard shaders on the original object, we should be able to use the internal (single-pass-compatible) shaders, but have them based on the incompatible ones from the bundle.