So I’ve got a component that creates materials at runtime, these materials set the flag “enableInstancing” to true. Problem is, Unitys is stripping the instanced variants because I assume it can’t detect that there’s any instanced variants when building, because of the runtime material creation.
I can fix this by changing the Graphics Settings of “instancing variants” to “Keep All”. But wondering if there’s a way to do this outside of that settings panel?
Maybe an Editor script, or some kind-of Post Process build script?
I would prefer to keep the setting as “Strip Unused” and just make unity aware of my dynamic materials. Maybe I have to let the user create the materials, set the “enableInstancing” flag themselves and assign to my component. Bit messy though as the component requires a certain shader that the user really shouldn’t be assigning