I'm looking for ability for Spine to use Unity's regular sprites internally for drawing.
Purpose: memory and draw calls optimization.
We're making a mobile game with isometric view, and it got a huge ton of sprites sorted by camera distance. Each Spine object break batching, adding +2 draw calls. Considering there are quite a lot of such objects - performance hit is quite noticeable.
To optimize it, I thought it may be good to swap spine objects with regular sprites when object is idle. Issue is it will require Spine to use actual Unity's sprites internally. They way SpriteAtlas support currenly is:
- Packing ALL spine sprites together with regular sprites into a single SpriteAtlas doesn't seem doable
- Packing to SpriteAtlas seems to be generating a new texture out of it instead of actually using the SpriteAtlas. This results source sprites to reference a different texture when drawing with SpriteRenderers, creating a duplicate textures as a result. When using addressables, it can get even worse
- Whole SpriteAtlas workflow is very hard to use to begin with.
Having Spine use actual Unity Sprites will simplify a lot of things:
- Can just pack them in SpriteAtlases together with other sprites automatically
- Better addressables support. Spine won't require to handle addressables manually - can just use normal Unity's workflow for SpriteAtlas late binding. This is possible because referencing a sprite does not force sprite's texture to be include in the build, so you can load it later and bind to the sprite.
- Potentially, can attempt to make Spine batch with normal sprites and each other. It will be a huge performance boost in general. Have to look into 2D Animations package - they also got freeform deformations, but batch with regular sprites. Considering package is plain C# - can study it and try making Spine use similar workflow instead of meshes. I considered making a converted from Spine to 2D Animations, but 2D Animations does not support direct vertex animations - only bones.
Original issue on GitHub:
EsotericSoftware/spine-runtimes2589