请注意,并不是创建了很多材质,而是创建了很多指向材质的数组。 每个阵列的典型大小为 1-5,如果您的大小为 10-20,您的插槽绘制顺序可能会得到改善。 正如我上面提到的,缓存任何以前的不同大小的数组会让事情变得更糟,所以我们不会在将来的任何脊柱统一更新中包含它。
如果您认为这是一个问题,请随意修改 3.8 spin-unity 运行时。 我们不会再发布 3.8 的任何更新,因此您可以放心地假设不会有更新覆盖您的代码修改。
既然您还提到了网格:您想在那里优化什么? 三角形索引数组已经不会在每一帧重新分配,它们会按需增长,并且在需要较少元素时不会收缩。
如果您使用裁剪,您应该考虑是否可以避免这种情况,因为这是一项成本非常高的操作。 此外,您还应该尽可能避免首先需要多种材质。
Note that it's not a lot of materials that are created, it's a lot of arrays of that are created which point to materials. Each array has a typical size of 1-5, if you have sizes of 10-20 your slot draw order can likely be improved. As I mentioned above, caching any previous arrays of different sizes would make matters worse, so we won't include this in any spine-unity update in the future.
If you consider that a problem, feel free to modify the 3.8 spine-unity runtime. We won't release any updates for 3.8 anymore, so you are safe to assume that there will be no update overwriting your code modifications.
Since you also mentioned Meshes: what would you want to optimize there? Triangle index arrays are already not re-allocated every frame, these grow on demand and don't shrink when fewer elements are needed.
If you're using clipping, you should consider wheter this can be avoided, as it's a very costly operation. Also you should try to avoid requiring multiple Materials in the first place as much as possible.