• 中文
  • 改变材质属性的同时使用SRP Batcher

  • Изменено
Related Discussions
...

In Spine Unity Runtime,
目前我的项目中使用MaterialPropertyBlock来初始化和修改材质属性,但根据Unity文档描述,使用MaterialPropertyBlock不兼容SRP Batcher,会造成性能下降。
请问如何在修改材质属性的同时启用SRP Batcher呢?

不幸的是,使用 MaterialPropertyBlock 会完全禁用 SRP 批处理器。 相反,当使用 SRP 批处理器时,您应该只设置材质(或渲染器)属性,这些应该由 SRP 批处理器在可能的情况下自动批处理(当着色器在 CBUFFER_START / CBUFFER_END 部分中具有这些属性并且一些其他限制允许 批处理)。


Unfortunately using MaterialPropertyBlock disables the use of the SRP batcher entirely. Instead when using SRP batcher, you should just set Material (or Renderer) properties instead, these should be batched by the SRP batcher automatically when possible (when the shader has these properties in CBUFFER_START / CBUFFER_END sections and some other limitations allow batching).