鉴于我的 unity webgl 项目中的角色重复同时出场的情况多,而且量比较大,所以我考虑把所有的图片都打包到同一个图集中,利用 dynamic batching 以提升性能。
项目中,角色的图片是以 种类/名称/方向/xx.png 的方式存放的,并且因为所有角色的部件基本上都比较标准,所以部件名称也很统一,比如:头、左手、右手等。
使用 spine 的纹理打包器打包某个种类,勾选了“合并子目录”,导入到 unity 中的 atlas region 显示为:名称/方向/部件名,这个是达到预期的,比如:小怪 1/正面/左手。
有办法直接在 unity 中使用这样的图集吗?我直接导入 skel 数据无法识别图集,而且由于大量文件一开始就用了这种命名方式,要把所有部件都改为唯一名称也不现实(macos 版的 spine 甚至无法直接输入中文,需要在别的编辑器中输入再粘贴进去)
当然,如果有更方便的、本质上解决 batch 问题的方案也行
Given the large number of characters appearing simultaneously in my Unity WebGL project, I'm considering bundling all images into a single atlas and using dynamic batching to improve performance.
In the project, character images are stored in the format type/name/direction/xx.png. Since the parts for all characters are relatively standard, the part names are also consistent, such as: head, left hand, right hand, etc.
Using Spine's texture packer to pack a specific type, with "Combine subdirectories" checked, the imported atlas region in Unity displays as: name/direction/part name, which works as expected, for example: "Small Monster 1/Front/Left Hand".
Is there a way to directly use such an atlas in Unity? Directly importing Skel file doesn't recognize the atla, and since many files initially used this naming convention, changing all parts to unique names is unimaginable (apparently the name with path is unique. And the macOS version of Spine doesn't even support direct Chinese input; you have to type it in another editor and then paste it).
Of course, any more convenient solutions that fundamentally solve the batching problem would also be appreciated.