Unity 2D animations

I am developing an platformer and recently i`ve faced with such a irritating problem.

I made an attack animation from the idle animation for the player. Seems not so difficult, isn't it? But then I wanted to make another one, but this time from the run animation. The robot(the main character) always keeps a wrench in his hand and this hand is animated while playing run animation. So I want to break a run animation, play attack and then return to the run animation in a certain time. Are there any functions in unity to make this?

Just break and continue but for unity animation...

Upvotes: 0

Views: 383

Answers (1)

Mykhailo Khadzhynov
Mykhailo Khadzhynov

Reputation: 467

Please, learn about unity`s animation system. There are a lot of video tutorials for basics things you asked.

In short, you have to use Animator Controller component, which have a state-machine inside for your animations. You can control this state-machine, setting parameters. So, to do what you want, you just need to set some defined trigger for attack, and then, when you need, set another trigger for run animation.

Upvotes: 1

Related Questions