• Unity
  • Performance and using multiple sprites in one spine object

I'll soon start using Spine, but I'm considering performance before I create stuff, and I somewhere read that each spine character/object uses one draw call, unless you replace sprites, where it will use one more draw call per sprite.

So in case I'd like to have background animation, like a flower, a bush and a tree, that all are animated in Spine. Wouldn't it be better to make all of them into one Spine object, with three animations, instead of having three different Spine objects?

That way it would be the same Spine object 3 times, just with different skins/animations playing on the scene, so it would only be one draw call even if I had 5 flowers and 5 trees at the same time.

Thank you in advance for any performance tips!

-niclas

Related Discussions
...
  • Düzenlendi
nicmar yazdı

[..]unless you replace sprites, where it will use one more draw call per sprite.

You can re-pack atlases at runtime to combine them to a single atlas to reduce the number of draw calls.
See the Spine Examples/Other Examples/Mix and Match and Spine Examples/Other Examples/Mix and Match Equip example scenes.

So in case I'd like to have background animation, like a flower, a bush and a tree, that all are animated in Spine. Wouldn't it be better to make all of them into one Spine object, with three animations, instead of having three different Spine objects?

You could pack all images of the three separate Spine-skeletons into a single shared atlas.
This can be done either at runtime via code, or in advance via the Spine Editor's Texture-Packer.

When things are in a single atlas page, then dynamic batching can kick in and combine them to a single draw call - if general batching requirements are met, see Unity's Batching Documentation. So e.g. vertex count must not be too high.