Hey,
I'm very new to using spine and I've been wondering if I'm doing this correctly.
Right now I have an animated character that needs to change animations depending if it's selected or not.
The code itself works but my IDE tells me that calling .addAnimation and .setAnimation are taxing.
private SkeletonAnimation spine;
[SerializeField] private AnimationReferenceAsset dragged, draggedIdle, idle;
private void SpineAnimation()
{
if (selected)
{
spine.state.SetAnimation(0, dragged, false);
spine.state.AddAnimation(0, draggedIdle, true,0);
}
else
{
spine.state.SetAnimation(0, Idle, true);
}
Basically, once it's selected the character will have the 'dragged' animation for just a moment, then it'll have the 'draggedIdle' animation and finally, if you let it go, it returns to the default 'idle' animation.
My question is: is there a more efficient way to do this? It was hard to find through the documentation...
Thanks