On the sprite switcher (attacher sorry, same idea as the examples thread in this forum) ignore the chest slot but basically something like this:
http://pastebin.com/ZT5e5Xv0
I noticed to get the chest working as an attachment I have to have all the sprites on their sides facing right and manually pivot them at the base. Perhaps I am over abusing the sprite attachment options a bit but they work well for main and offhand weapons if drawn sideways and manually pivoted in unity.
None of the weapons are the same size nor offhands, so I just have the one Weapon and Offhand attachment in Spine and then call the swap in unity from a unity packed atlas of images. At runtime it seems to add a new attachment for every single sprite, but not sure there's any way around that.
We have maybe 80 chest sprites for equipment, 80 helmets, 30 shields, 600 weapons (might need to discuss this one with designer, just now calculated this number and am a bit in non-agreement, lol).
We wanted to use mesh deformation but yea if the dimensions aren't drawn in exactly the same area for all "leather chests" or "plate chests" then it won't be possible. I see possibly create 4 attachment slots each with their own deformation, but im not sure the deform will carry into unity if we use sprite attacher to swap it out at runtime with a unity sprite.
Maybe we need to pay for consulting lol 😉 We are making a very complex ARPG and having to cut corners in places as it is due to the performance of the multiplayer host needing to track hundreds of running anims.
06 Aug 2015, 13:56
I re-read this and I think we're doing close to what you're describing, I just used different terminology.
We have packed atlases in unity and define a [SpineSlot] weaponSlot, [SpineSlot] headSlot which i target with:
Spine.Attachment mainhandAttachment = skeletonRenderer.skeleton.Data.AddUnitySprite(weaponSlot, ItemManager.Instance.equipmentSprites[image], skin, "Custom/SpriteAdditive");
skeletonRenderer.skeleton.SetAttachment(weaponSlot, image);
I guess by using Unity sprites you lose all the mesh benefits and get extra overdraw but if they were all the exact same dimensions and pivot yea that would make things easier... just be an issue to draw all daggers in the same pixel space as giant 2h axes etc.
Aside from that this is the other problem that I'm not sure is a problem or not by using my above code.. every image swap adds a new slot.
http://snag.gy/rxIKG.jpg
Also looks like we lose all FFD if we swap out the image with unity (as seen with the weapon slot), so the only option might be to put all equipment in spine atlases if we need that custom of animations?