I’ve just installed Unity 6.0. I want to draw 2 cubes using GPU instancing (just to test things out).
I know that to enable GPU instancing I have to disable SRPBatcher. There is a manual how to do this:
but I have to be too dumb to understand it.
I decided to use Removing shader compatibility because I don’t know how to add a MaterialPropertyBlock to the renderer. since I just want to add 2 cubes and use the same material.
Manual says this:
To make a Unity shader incompatible with the SRP Batcher, you need to make changes to the shader source file:
For hand-written shaders, open the shader source file. For Shader Graph shaders, copy the Shader Graph’s compiled shader source code into a new shader source file. Use the new shader source file in your application instead of the Shader Graph.
Add a new material property declaration into the shader’s Properties block. Don’t declare the new material property in the UnityPerMaterial constant buffer.
So I added 2 cubes, created a new Standard Surface Shader and a new material that uses that shader.
Check your console. Are there any errors reported after you modified the shader? It could be something as simple as a syntax error. As for GPU instancing, it’s probably because the shader is currently broken. No working shader - no instancing.
Silly question but does the unmodified version of the shader work for URP? Also, can you post what modification you made to it so we can see if there is anything wrong? You don’t need to post the whole shader, just the property you added.