感谢您的附加信息。 一般来说,拥有一个大图集纹理还是拥有多个小纹理总是取决于您的用例。 大纹理的大小是多少,下载时间是否太长(如果您不下载它并将其与游戏可执行文件一起提供,下载时间无关紧要)? 或者大小是否超出了最低目标硬件的限制? 如果您不下载纹理或执行任何其他按需加载,如 Unity Addressables 或 Asset Bundles,所有纹理无论如何都会在关卡加载时立即加载(只要存在对纹理资产的任何间接引用,它们就会被加载), 所以当使用多个小纹理而不是单个大纹理时,它不会改变加载时间。
他有30套皮肤可以更换,每个皮肤里面都包含(头发,脸型,眼睛,眉毛,上衣,下衣,鞋子)等部件
不幸的是,关于 30 皮肤的机器翻译仍然有点模棱两可:每个皮肤是否只包含一个装备项目而没有其他东西? 比如黑发一张皮,棕发一张皮,蓝裤子一张皮,黑裤子一张皮? 或者一张皮肤是否包含多个项目,如头发、裤子、上衣等?
如果每个设备项目只有一个皮肤,您可以使用皮肤 API 将皮肤添加到组合皮肤中,如 此处。 如果您想使用 Addressables 或 AssetBundles 或其他按需加载功能,则需要一些编码。 然后,您将从材料中删除对纹理的任何直接引用(例如,通过预构建步骤自动进行,然后在构建后再次恢复它)并按需下载纹理并将它们分配给各自的材料。 您可以查看此论坛帖子中的描述:
翻译:
如果您决定自己实现此功能而不是等待官方实现,我建议在设置和加载任何皮肤时添加一层间接层(例如,一个新的 SkinLoader 组件类)。 作为准备工作,您将从任何 SkeletonDataAsset 引用级联中删除除默认皮肤资产以外的所有资产。 然后您可以在 skinLoader.SetSkin(targetSkeletonAnimation, "skinname") 处设置您的皮肤,它首先检查它是否已加载,按需加载它并连接任何引用,然后调用 targetSkeletonAnimation.Skeleton.SetSkin(skinname)。 这样它应该是可行的,而不必修改 spine-unity 代码。
然后,您可以按照 下面的文档 创建单个纹理并减少绘制调用。
Thanks for the additional information. In general whether it's better to have one large atlas texture versus multiple small textures always depends on your use case. What is the size of the large texture, does it take too long to download (if you don't download it and ship it with the game executable, download time won't matter)? Or does the size exceed the limitations of your minimum target hardware? If you don't download the textures or perform any other on-demand loading like Unity Addressables or Asset Bundles, all textures are anyway loaded at once at level-load time (whenever any indirect reference to texture assets exists, they are loaded), so it does not change loading time when using multiple small textures instead of a single large texture.
他有30套皮肤可以更换,每个皮肤里面都包含(头发,脸型,眼睛,眉毛,上衣,下衣服,鞋子)等部件
Regarding 30 skins machine translation unfortunately still was a bit ambiguous: Does each skin only contain a single equipment item and nothing else? Like one skin for black hair, one skin for brown hair, one skin for blue trousers, one skin for black trousers? Or does a single skin contain multiple items like hair, trousers, tops, etc?
If you have a single skin per equipment item, you would use the Skin API to add skins to a combined skin as documented here. If you want to use Addressables or AssetBundles or other on-demand loading functionality, there is a bit of coding required. You would then remove any direct references to textures from your materials (e.g. automatically via a pre-build step, then restore it in post-build again) and on-demand download the textures and assign them at their respective material. You can check out the description in this forum posting:
Translation:
If you decide to implement this feature yourself and not wait for the official implementation, I would recommend adding one layer of indirection (e.g. a new SkinLoader component class) around setting and loading any skin. As a preparation you would then remove all but the default skin's assets from any SkeletonDataAsset reference cascades. Then you would set your skin at skinLoader.SetSkin(targetSkeletonAnimation, "skinname") which first checks if it's loaded, loads it on demand and hooks up any references, and then calls targetSkeletonAnimation.Skeleton.SetSkin(skinname). This way it should be doable without having to modify the spine-unity code.
You could then repack the combined skin as shown in the documentation immediately below to create a single texture and reduce draw calls.