Alkhem

Hi,

I'm seeking for a better solution for a Spine character that has to use 100+ pieces of equipment.
Such character is already working in Unity, but my engineer and I think the current setup is prone to creating problems in the future and is not ideal. I'll explain.

The character moves to all directions (top view), which means some of his equipment has a "front" and "back" look.
So far in Spine I made bones that the engineer attaches the equipment to, but all of it is done manually, increases work and chance of mistakes and bugs, and also limits the animations.

We have bones for front and back for each attachment position (weapon_front, weapon_back). In Unity we have an object with a BoneFollower component following each of these bones (weapon_front, weapon_back).

The engineer disables/enables front nodes or back nodes depending on the animation we want to play. The attachments (weapons) are Spine’s SkeletonAnimation, we don’t use Sprites, as the examples we have seen online. The reason for this is because we want to have specialised animations for each attachment (weapon).

My engineer asks if it's possible to switch Bones on/off (Bones, not slots nor images), but that clearly has no effect in Unity because it's not "keyable".
The idea would be to handle visible and invisible equipment by altering a bone's visibility.

Any suggestions on how to improve/change this?


PS we've already checked the following video but it doesn't address our case:
Alkhem
Beiträge: 3

Pharan

Your issue is also two separate problems:
1. Your skeleton has multiple views, and it's problematic if you put them all in one skeleton because you need to do all the programmatic emptying/setting of specific slots, or excessive keying of those values in Spine. It's much simpler to have separate skeletons for each view. In your example, one front skeleton, one back skeleton. And one of each view you didn't mention.

2. That video is very old and is not quite recommended anymore. The script associated with it has been moved to the Sample Scripts, as it's not meant to be used for production without proper adaptation.

Instead, we are recommending what people have been calling the "Mix and Match" workflow. It basically involves using and animating with a dummy Skin in Spine. And then populating an actual custom Skin in Unity to stand in the place of the dummy skin.
For this, BoneFollower is not necessary, which also simplifies the sorting process (gives the sorting control to the Spine animator where it belongs).

You can get existing attachments to populate your custom skin. Or you can generate new attachments from UnityEngine.Sprites. These can be entirely new Attachments from Sprites, or new Attachments based on existing/dummy/template attachments with their images replaced with a Sprite's texture (This is especially handy where you need to have meshes and weights/deformation).

We're currently working on solidifying the "Mix and Match" documentation for Spine-Unity.
Currently, there's a sample scene (Mix and Match) and code (MixAndMatch.cs) that comes with the Spine-Unity unitypackage.
But the current task is to round it out with more thorough documentation and sample Spine project (both still in progress):
https://github.com/pharan/spine-unity-docs/blob/master/Mix-and-Match.md

The functionality is already there but it might not be immediately clear how to do it. But people have already been using this for equip systems and character customization and we've been getting good feedback on it.

To address your various questions and points:
- You can't disable bones. Even in Spine, that does nothing but disable the arrow-y visual representation of bones. Not the images connected to them. If you need to hide an attachment/image, you need to set its Slot.Attachment value to null.
Slots and bones sort of live in separate parts of the system. There's no way to "disable bones" such that all the slots under them won't render.
-
The attachments (weapons) are Spine’s SkeletonAnimation, we don’t use Sprites, as the examples we have seen online. The reason for this is because we want to have specialised animations for each attachment (weapon).
What do you mean by "specialised animations"? What do you mean by "attachments are Spine's SkeletonAnimation"?
Official Esoteric Assorted Furniture Cleaner and Teahouse | Check out the Spine Users Tumblr Blog: spine-users.tumblr.com
pharan.deviantart.com | pharantriestoanimatestuff.tumblr.com - - - Windows 10 - Spine-Unity.
Benutzeravatar
Pharan

Pharan
Beiträge: 4275

Alkhem

Hi Pharan,

thanks for the reply.

I answer your last question first.
In other words, I mean that we want animated equipment (for example a fire sword and a fire double-axe, each having their own specific animation for the fire). So in Unity we want to attach SpineSkeletons to the hand bone, not merely PNGs as the old video shows.

However I've just found this old post (1.5 years ago) where you mention that it's not possible to attach 2 skeletons:
http://esotericsoftware.com/forum/Animated-Attachments-across-Multiple-Characters-5687

The workaround you suggested in the older post sounds like what we are currently doing, but, as you also pointed out, it requires a lot of manual work in Unity and given the increasing quantity of animations we are planning it doesn't seem convenient in the long run.

Is there anything else we could try at the moment?
Alkhem
Beiträge: 3

Pharan

Ah, so they need to be animated independently. In that case, separate Skeletons/SkeletonAnimations and BoneFollower, and possibly SkeletonRenderSeparator are currently your only option.

This is because Spine itself currently does not support attaching a skeleton to another skeleton natively, so you have to rely on the Unity side to do that for you, and manage enabling, disabling and playing animations on them yourself.

If the equips didn't need to be animated independently, you would not have this requirement. As it is, this is the cost of having unique animations on arbitrary weapons. I imagine it would be the same even if you were to do things in 3D or on a different animation package.
Official Esoteric Assorted Furniture Cleaner and Teahouse | Check out the Spine Users Tumblr Blog: spine-users.tumblr.com
pharan.deviantart.com | pharantriestoanimatestuff.tumblr.com - - - Windows 10 - Spine-Unity.
Benutzeravatar
Pharan

Pharan
Beiträge: 4275

Alkhem

Yes, looks like it's the only option.
Thanks for your help!
Alkhem
Beiträge: 3


Zurück zu Unity