Any way to know if a shader variant has been stripped from exported build?

Hi guys,

I would like to know, from an exported build, if a shader variant has been stripped during the export. I am specially interested about the instancing variant.
I have a shader which support GPU Instancing. However the material of this shader is created at runtime, and I enable the instancing via the scripting API.
Since there is no material asset with instancing enabled using this shader in the project, the export strips the instancing variant of my shader when the “Instancing Variants” property is set to the default “Strip Unused” value in the Graphics Settings:
5885111--627149--Screenshot_75.png

Is there any way to know is my instancing variant has been stripped from the exported build?

When I enable the instancing from script, the bool stays properly at true, so I cannot check that:

material.enableInstancing = true;

I also tried to check if the keyword INSTANCING_ON was enabled (via Material.IsKeywordEnabled) since it appears in the frame debugger, but it’s never possible to retrieve it from script (even when the instancing variant is properly exported).
5885111--627152--Screenshot_76.png

Thank you.

Hi!
The easiest way is, probably, to check this visually - make the color output different based on this keyword and see what color you get.

Hi and thanks for the suggestion.
I would have prefer a way to trigger a proper error message, but it’s better than nothing :slight_smile:
It could be useful to prevent from setting the enableInstancing property at true on a material which doesn’t have the instancing variant available (the getter of the property could always return false).
Or being able to retrieve the INSTANCING_ON keyword from script would make sense too.
Thanks