i am working on mobile game project that'll have 48 characters and each character has their own 4 skin. in menu i have like 10-11 SkeletonGraphics object. Also in gameplay i have 2 SkeletonMechanim object. i am also using 2 png atlas maybe in future it'll be 4 or 5 idk. also i want to use these characters in 8k and high quality compression but idk if it's enough. build size will be huge. how can i optimize this project?
How can i optimize spine objects in my project.
To optimize your Spine project for a mobile game with multiple characters and skins, consider the following strategies:
Texture Atlases: Use texture atlases efficiently to minimize the number of texture binds. You can repack atlases at runtime to include only the images needed for the current scene or character, which can help reduce memory usage and improve performance. This is especially useful if you have many skins or characters sharing similar parts.
Reduce Draw Calls: Minimize draw calls by combining multiple characters' attachments into fewer texture atlases. This can be done by pre-packing them in the Spine Editor or using runtime repacking techniques. Be cautious with the number of atlas pages, as more pages can increase draw calls.
Optimize Skeletons: Use fewer bones and keys where possible without sacrificing animation quality. This reduces processing overhead. Also, consider using bones instead of direct mesh deformations to optimize performance.
Image Size and Compression: While you want high-quality images, consider the trade-off between quality and performance. Use appropriate compression settings to balance quality and file size. Test on target devices to ensure performance is acceptable.
Identify Bottlenecks: Profile your game to identify performance bottlenecks. Optimize only those areas that impact performance significantly. Avoid premature optimization.
Memory Management: Be mindful of memory usage, especially with high-resolution textures. Consider using lower resolution textures for less critical elements or when high detail is not necessary.
By implementing these strategies, you can optimize your Spine project for better performance on mobile devices while maintaining visual quality.
@meanwhile You might also want to consider using on-demand loading of atlas textures if you have very large atlas textures. The spine-unity runtime provides an experimental Addressable-based and a generic on-demand package, see this github issue ticket for details:
EsotericSoftware/spine-runtimes1890
Just be sure to use the 4.2 branch URLs for the 4.2 runtime instead of 4.1:
EsotericSoftware/spine-runtimes.git?path=spine-unity/Modules/com.esotericsoftware.spine.on-demand-loading#4.2
EsotericSoftware/spine-runtimes.git?path=spine-unity/Modules/com.esotericsoftware.spine.addressables#4.2
Also check out this spine-unity FAQ section on performance:
https://esotericsoftware.com/spine-unity-faq#Performance