• Unity
  • Unity timeline and multiple SpineDataAsset

Hello everyone!

At this moment i'm trying using Unity timeline(PlayableDirector) for creating animation sequences in my game. I think it great tool, because creating very comfortably and i can see result right in the editor.
For timeline track i use default? spine solution - SpineAnimationStateTrack. Track has binding to SkeletonAnimation, then clips places to track and animation just playing.

Clip has a reference to AnimationReferenceAsset, ARS has reference to SkeletonDataAsset.

I have about ten character in my game with same animation names, but different animations. Problems begin when i set other SkeletonDataAsset in my SkeletonAnimation component. In this case, there are problems with the animations themselves - some part disappears, or I just get exceptions. For solve this problem need replace all AnimationReferenceAsset to other ARS with right SkeletonDataAsset.
As an opinion, a may rebind reference for all clips in SpineAnimationStateStack before PlayableDirector start playing, but i need store all AnimationReferenceAsset's from my all characters, what seems like a bad decision.

Has anyone encountered a similar problem and was there a good decision using PlayableDirector for creating animation sequence in this case?
Thanks.

Related Discussions
...
Serogriff a écrit

Problems begin when i set other SkeletonDataAsset in my SkeletonAnimation component. In this case, there are problems with the animations themselves - some part disappears, or I just get exceptions. For solve this problem need replace all AnimationReferenceAsset to other ARS with right SkeletonDataAsset.

Unfortunately this is more of a general design problem with AnimationReferenceAssets. They are referencing an animation on a specific SkeletonData asset directly via object reference, not via the name. The name it is used for initial lookup only, but stored as object reference later. The problem is that if you change the user's SkeletonData asset, all AnimationReferenceAssets would need to be swapped for out with suitable ones of the other SkeletonData asset. Changing the existing SkeletonData asset at the AnimationReferenceAssets upon use and mismatch is not an option, since the asset needs to be kept intact.

Therefore the only real solution that I can think of that is capable of handling SkeletonData asset switching would be an additional AnimationReferenceAsset type that uses only the name string and does not depend on an actual animation. On the other hand, storing only the animation name and having no skeleton reference at the asset is also not a really clean solution, so I'm not really happy with such an asset type either.

TLDR: When switching the SkeletonData asset you will have to switch the referenced AnimationReferenceAssets out as well, any rebind or similar action would be incorrect.