GameDev : Animation in Unity!!
Let’s time for us to set up some beautiful animations!
In Unity we can create animation with ANIMATION WINDOW.
Objective : create an Animation.
To use it, we have to highlighted the Object we want to animated, go to Windows, Animation, Animation.
It opens Animation window and we can dock it next to the Console
From that windows, we click on “Create”
It opens another window.
Inside this window, first, we create another Folder and we call it “Animations”, so every animation we have will be inside this folder.
Inside Animations folder, we create a “Triple_Shot_Powerup_anim”.
The Animation window is now changed.
Now, to create an animation, we have to highlighted the object, then press the RECORD button.
When turn it red it means we can record the animation.
In my case, I have these art for Powerup
What I have to do is select the first, hold Shift and select the last, so I take everything, and drag it all in the Animation window
If we hit PLAY in the ANIMATION WINDOW we see it in movement
If we are ok with Animation, click Record button again to stop Recording.
After stop it, two thing happen : inside Animator folder now we have Triple Shot Powerup anim, and the CONTROLLER.
The CONTROLLER, as the name suggests, controls the logic behind the animation.
This is only one animation, but sometimes we have a tons of animations.
Imagine a Player with combos, jump, various attack, etc etc.
If we select the Powerup, in the inspector we see that Unity has added an ANIMATOR COMPONENT, and inside the Controller it is already set.
To understand better what is a CONTROLLER, try to double click on it
This is the ANIMATOR WINDOW.
Sound similar, but ANIMATOR and ANIMATION are different.
What happen in this window?
Let’s look at it.
HOW TO MOVE INSIDE THIS WINDOW :
to zoom in and out we can use the mouse wheel,
to MOVE INSIDE WE HAVE TO CLICK ALT+HOLD DOWN LEFT MOUSE BUTTON and move around.
To select and move things inside HOLD DOWN LEFT CLICK and move.
Now, let’s look what’s happen inside this window during the animation.
Then press Play
As we can see, the animation continue in loop. That’s what we want, but in the inspector there is a toggle to choose if it has to loop or not.