From this document https://docs.unity3d.com/6000.3/Documentation/Manual/optimizing-draw-calls-choose-method.html , it is recommend to Disable, to avoid extra shader variants, not sure how to disable it? is that the one in material settings "Enable GPU Instancing"?
#How to disable GPU Instancing?
1 messages · Page 1 of 1 (latest)
I'm pretty sure you'd have to remove #pragma multi_compile_instancing from the shader. "multi_compile" implies that it's always going to compile the variants that support GPU instancing, whether or not any materials actually use it
The docs page is about draw call optimization, so I think in that context it's enough to uncheck it on the materials, so that the instanced variant is not used.
it says that you should disable it to reduce your variant count
I think this is just poor wording. If you follow the link to the gpu instancing page and the the "enabling" page, it says:
To enable GPU instancing for a prebuilt materials, follow these steps:
Select the material in the Project window.
In the Advanced Options section of the Inspector
window, enable Enable GPU Instancing.
Note: If you use the Universal Render Pipeline
(URP) or High Definition Render Pipeline (HDRP), the recommended best practice is to use the SRP Batcher instead, which is enabled by default. GPU instancing works only if you disable the SRP Batcher.
Nothing about variants.
Anyways, the question has been answered regardless of which one they meant:
- To prevent gpu instancing variants from being used, just uncheck the gpu instancing check on the material.
- To prevent the variants from compiling entirely, use custom shaders that don't support gpu instancing, or modified versions of the standard shaders.
Wouldn't shader stripping also remove those variants, as long as they're not used?