Eric Well
Mar 16, 2023
Removing shader compatibility 时,按照官方文档操作:
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.
The material property doesn’t need to do anything; just having a material property that doesn’t exist in the UnityPerMaterial constant buffer makes the shader incompatible with the SRP Batcher.
操作完发现依然是compatible,无效啊,只能通过renderer.SetMaterialPropertyBlock()方式搞。。