Hello! Great tool you guys are developing here!
I'm looking to develop a 2D paperdoll/clothing system in Unity and recently heard about Spine. I just started looking into the Spine Unity Runtime and have been going through these forums to find suggestions on where to begin.
What I'm already a little familiar with is Unity's new 2D sprite rendering system and the way it automatically packs sprites into atlases based on the Sprite Packing Tags. What I want to be able to do is change the various sprites on a Spine animation to arbitrary sprite assets. (Arbitrary here meaning that the Spine tool itself may not already know about these sprite assets. But Unity does.)
From what I'm seeing on these forums, two of the main routes for something like this would be:
1.) Write a tool to edit the data in the Spine JSON and Atlas data for the Skeleton so that it includes any sprite assets I want to be able to use on certain slots on the Skeleton. The Skeleton will automatically detect the new data and I can edit the slot using SetAttachment(slot_name, sprite_name) on the Skeleton.
2.) Write a new AttachmentLoader that does not use a Spine Atlas and, instead, is able to create some custom Attachment for any arbitrary Sprite.
I was able to implement solution #1, but realized that this generates a new Material for every Sprite, increasing the draw calls. Is there any way I can get this to NOT generate new Materials for every sprite and stick to just a few Materials containing all the Sprites like Unity's SpriteRenderer? In other words, is there a way to take advantage of Unity's Sprite packer to reduce the number of Materials and maintain a low draw call count?
For solution #2, I'm still working through the Spine Unity Runtime code to try and figure this out. Was hoping to have something before I posted here, but I'm still going at it. Any directions for this would be greatly appreciated.
Thanks in advance for any suggestions!
I just learned that I could use TexturePacker and export for libGDX to get an atlas and image on all the arbitrary sprites I want to use. This combined with editing the Spine JSON data should get me what I need along with a minimal material count.