防止批次增加的最佳方法是在运行时将多个图集重新打包为单个图集。 请参阅[此处]的文档部分(https://zh.esotericsoftware.com/spine-unity#%E7%BB%84%E5%90%88%E7%9A%AE%E8%82%A4)。 这是您的选择吗?
否则,应用正常的 Unity 批处理规则。 它在很大程度上取决于网格边界以及具有相同两个或更多图集页面的多个“SkeletonGraphic”对象是否可以批量处理的位置。 如果它们在 XY 方向上不重叠并且位于相同的深度 (Z) 位置,它们仍将被批量处理,但并非总是如此。 一般来说,Unity 需要确保正确维护渲染顺序,因此一种安排可能会被批处理,而另一种则不能。
理论上可以批量为 AAA 和 BBB:
↓ 相机朝这个方向看
[A] [A] [A]
[B] [B] [B]
这不能批处理,因为渲染顺序是错误的,它必须像 A B A B A B 一样交替,因为它部分重叠:
↓ 相机朝这个方向看
[A]
[B]
[A]
[B]
[A]
[B]
The best way to prevent batches from increasing is repacking multiple atlases to a single one at runtime. Please see the documentation section here. Is this an option for you?
Otherwise, normal Unity batching rules apply. It heavily depends on the mesh bounds and on the position whether multiple SkeletonGraphic
objects with the same two or more atlas pages can be batched or not. If they don't overlap in XY direction and are at the same depth (Z) location, they will still be batched, however not always. In general Unity needs to ensure that the render order is correctly maintained, so one arrangement might be batched while another can't be.
This can theoretically be batched as AAA and BBB:
↓ camera looking in this direction
[A] [A] [A]
[B] [B] [B]
This can't be batched since render order would be wrong, it must be alternating like A B A B A B since it's partially overlapping:
↓ camera looking in this direction
[A]
[B]
[A]
[B]
[A]
[B]