1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:06,000
Now that you worked a bit with animations, I want to show you my video on explaining how the animator

3
00:00:06,000 --> 00:00:06,000
works.

4
00:00:06,000 --> 00:00:07,000
Exactly.

5
00:00:07,000 --> 00:00:08,000
Let's watch it together.

6
00:00:08,000 --> 00:00:14,000
All right, guys, We already have an idle animation and the run animation, but I want to take a step

7
00:00:14,000 --> 00:00:19,000
aside and talk about animations in general and explain how the animator work in Unity.

8
00:00:19,000 --> 00:00:23,000
So the animator in Unity works like a state machine.

9
00:00:23,000 --> 00:00:26,000
And to give a good example, we can take a traffic light.

10
00:00:26,000 --> 00:00:31,000
So traffic light has only three states in it and stop, wait and go based on three colors.

11
00:00:31,000 --> 00:00:32,000
Right.

12
00:00:32,000 --> 00:00:35,000
And traffic light cannot have two states working at the same time.

13
00:00:35,000 --> 00:00:40,000
So if red state is on, then other two is off.

14
00:00:40,000 --> 00:00:43,000
If you turn on green state, then other two is off.

15
00:00:43,000 --> 00:00:45,000
Same with the animations.

16
00:00:45,000 --> 00:00:47,000
We can play only one animation at a time.

17
00:00:47,000 --> 00:00:53,000
Usually I guess it controlled by the timer or maybe some traffic police officer, but let's imagine

18
00:00:53,000 --> 00:00:55,000
it controlled by the remote.

19
00:00:55,000 --> 00:01:01,000
So whenever I press red button it shows me the red light and let's say it shows me the red light animation

20
00:01:01,000 --> 00:01:05,000
when I press yellow and it shows me yellow, when I press green, it shows me green.

21
00:01:05,000 --> 00:01:05,000
Very simple.

22
00:01:05,000 --> 00:01:13,000
Now, in our case, let's imagine our traffic light is a player and player can wait in idle animation,

23
00:01:13,000 --> 00:01:15,000
it can jump and it can run.

24
00:01:15,000 --> 00:01:18,000
But I don't have remote for animations.

25
00:01:18,000 --> 00:01:26,000
I have this C-sharp player controller script that I can use to control the animations in animator controller.

26
00:01:26,000 --> 00:01:27,000
I hope that makes sense.

27
00:01:27,000 --> 00:01:29,000
So this is what we're going to do.

28
00:01:29,000 --> 00:01:34,000
We're going to use our player controller script as a remote controller for our animation.

29
00:01:34,000 --> 00:01:41,000
Basically, in a summary, I can say that animator in Unity acts as a traffic light and script of the

30
00:01:41,000 --> 00:01:46,000
player that controls animator component acts as a remote control the traffic light.

31
00:01:46,000 --> 00:01:48,000
So let's get into it, see in the next video.

