Thanks for checking out this thread

I need to implement the feature that if I press the button,
the character which is currently playing the IDLE animation should immediately play
Attacking animation.
I've code some stuff but what I am seeing is that
if I press the button, there is some interpolation to the 1st frame of attacking animation,
then it returns to play idle one. Without playing the attacking animation.

So here are the questions
1) Is there any way that I can immediately switch the current animation to another when I
press the button?

2) What would be the best practice to make the animation respond to the keyboard input that
the user give in Unity environment?

Thank you so much in advance!
  • Postovi: 1



The spine-unity runtime has some good example scenes to see how to do that you want :

Spine Examples/Getting Started/4 Object Oriented Sample
Spine Examples/Getting Started/5 Basic Platformer
Other Examples/Animation Tester/Animation Tester

Those examples work depending on the key input, but you just need to change the if statement.

If you don't mind posting your code, we can see what exactly is wrong.

  • Postovi: 306


Please note that if you see the first frame of your target animation but an undesired transition to another animation thereafter, most likely your gameplay logic is wrong. Most likely you accidentally triggered a transition to your idle animation. You can either add breakpoints or Debug.Log statements to the respective code that triggers idle animation playback to check whether it is executed where you don't want it to be.

  • Postovi: 3568

Natrag na Unity