WEBVTT

00:00.040 --> 00:03.000
We need to make transition from animation state.

00:03.000 --> 00:06.560
Basically, we need to make transition between animation.

00:06.560 --> 00:12.000
So if we select our player game object in the hierarchy, then move over to this animator tab.

00:12.000 --> 00:14.080
We can see we have two animation.

00:14.440 --> 00:18.040
So this player underscore run animation clip is the default one.

00:18.040 --> 00:22.680
Basically if we just click on this play button in the top, you will see this animation.

00:22.680 --> 00:26.720
Just gonna play right away as soon as the game started.

00:26.720 --> 00:32.920
And let's suppose you just want to make any other state, any other animation state a default one,

00:32.920 --> 00:35.040
then you can do that as well.

00:35.040 --> 00:41.120
So as you can see, as soon as the game started, we can see this player just playing the run animation

00:41.120 --> 00:43.280
clip over again and again.

00:43.280 --> 00:48.080
So let's suppose you just want to make this jump animation clip to be the default one.

00:48.080 --> 00:53.280
So you what you basically have to do, you need to select the animation clip first, then right click

00:53.280 --> 00:54.960
on it and then click on this.

00:55.120 --> 00:58.760
Click on this set as layer default state as.

00:58.800 --> 01:05.020
As soon as we have chosen we can see now player underscore jump animation clip is the default one.

01:05.220 --> 01:07.820
So we don't want this to be default one.

01:07.820 --> 01:08.820
This jump one.

01:08.820 --> 01:13.660
Instead, we want the player underscore run animation clip to be the default one.

01:13.660 --> 01:15.060
So we're going to get out of play mode.

01:15.060 --> 01:19.980
And we're going to make this player underscore run animation clip to be the default one.

01:19.980 --> 01:24.380
So let's right click on it and then click on set as default state.

01:24.380 --> 01:29.220
So what we need to do now we need to make transition between these animation state.

01:29.220 --> 01:30.660
So let's suppose we jump.

01:30.660 --> 01:35.620
So in that moment we need to play this jump animation clip instead of this run.

01:35.620 --> 01:40.540
And as soon as this player game object just gonna land on top of this ground at that moment, we're

01:40.540 --> 01:43.420
gonna play this run animation clip.

01:43.420 --> 01:49.620
So while we are jumping, then we're gonna make a basically we're gonna play this player jump animation

01:49.620 --> 01:50.140
clip.

01:50.140 --> 01:56.980
And once this player game object are running on the ground, then at that moment we're gonna play this

01:56.980 --> 01:58.460
run animation clip.

01:58.460 --> 02:02.020
So we need to make transition between this animation state.

02:02.020 --> 02:04.580
So what we need to do we need to make transition.

02:04.580 --> 02:06.260
So let's do transition.

02:06.260 --> 02:11.720
So we're going to select our player underscore run animation clip, then right click on it and make

02:11.760 --> 02:13.400
transition to player jump.

02:13.400 --> 02:15.840
And then select this transition or this arrow.

02:15.880 --> 02:18.000
Then go over to Inspector in the right.

02:18.000 --> 02:18.960
And we're going to untick.

02:18.960 --> 02:20.320
This has exit time.

02:20.320 --> 02:20.760
Why.

02:20.800 --> 02:26.880
Because as soon as we press down Space Key then we just want to play this jump animation clip right

02:26.880 --> 02:27.280
away.

02:27.520 --> 02:29.440
We don't want any delay.

02:29.440 --> 02:30.840
So that's why we just untick.

02:30.880 --> 02:35.520
This has exit time as well as we're going to set the transition duration to zero.

02:35.560 --> 02:37.520
We're not gonna delay.

02:37.800 --> 02:41.840
And if we scroll down we need to choose a condition in which condition.

02:41.840 --> 02:46.440
We just want to play this jump animation clip of this player game object.

02:46.440 --> 02:49.760
So I'm gonna choose a some certain condition or parameters.

02:49.760 --> 02:55.720
So if you just move over to this animator tab in the left side you can see layers and we have parameters.

02:55.720 --> 03:00.480
So just move over to this parameter section and then click on this plus icon.

03:00.480 --> 03:04.920
And we're going to choose this ball in the bottom pool which can be true or false.

03:04.920 --> 03:10.520
And we have to name the parameter what with what we would like to go with.

03:10.520 --> 03:12.660
So I'm going to call it something like jump.

03:13.300 --> 03:19.300
So let's call that jump and then select this arrow or this transition over to Inspector.

03:19.300 --> 03:24.380
Scroll down and then click on this plus icon in order to choose the parameter.

03:24.380 --> 03:26.500
So we're going to choose is jump is true.

03:26.620 --> 03:33.220
So now if I just click on this play button and then try to set this jump parameter uh to manually true

03:33.220 --> 03:33.860
to false.

03:34.020 --> 03:36.420
So this bull can be true or false.

03:36.740 --> 03:38.100
It's going to have to value.

03:38.100 --> 03:39.860
It can be true or false.

03:40.020 --> 03:45.940
So now if we set our manually basically check this jump parameter to true means check.

03:46.140 --> 03:49.260
As soon as we check we can see this player game object.

03:49.300 --> 03:51.780
Now plays this jump animation clip.

03:51.980 --> 03:54.620
So we need to set this jump parameter to true.

03:54.620 --> 03:55.500
Basically check.

03:55.540 --> 03:57.340
And once we set we're going to play.

03:57.660 --> 04:01.420
Uh it just plays jump animation clip of this player game object.

04:01.420 --> 04:01.860
Why.

04:02.020 --> 04:07.300
Because if we select this arrow from this run to jump and then go over to Inspector, scroll down,

04:07.300 --> 04:10.980
we can see we have chosen that condition if jump is true.

04:10.980 --> 04:16.480
So it's going to play the jump animation clip right away, but once we set this jump parameter to false,

04:16.480 --> 04:21.080
basically uncheck we not playing this run animation clip once again.

04:21.080 --> 04:27.480
So we also need to make transition from this player jump to player run or we will stuck in this jump

04:27.520 --> 04:29.040
animation clip forever.

04:29.040 --> 04:32.760
So let's get out of play mode by clicking on this play button in the top.

04:32.920 --> 04:35.480
And let's make transition back to this player.

04:35.480 --> 04:37.040
Run from this player jump.

04:37.040 --> 04:42.240
So let's right click on this player jump and make transition back to player run and then select this

04:42.240 --> 04:42.840
transition.

04:42.840 --> 04:45.360
Then go over to Inspector and we're going to untick.

04:45.360 --> 04:48.680
This has exit time basically as soon as player.

04:48.720 --> 04:54.880
Just going to land top of this ground then I want this I want this run animation clip to be play right

04:54.880 --> 04:55.200
away.

04:55.200 --> 04:57.240
And I don't want any delay.

04:57.240 --> 05:02.960
So that's why I just uncheck has exit time as well as I'm going to choose the transition duration to

05:03.000 --> 05:03.400
zero.

05:03.560 --> 05:07.080
And if we scroll down we need to choose a condition in which condition.

05:07.080 --> 05:10.080
We just want to play this run animation clip.

05:10.080 --> 05:11.720
So I'm going to choose this jump condition.

05:11.720 --> 05:13.520
So let's click on this plus icon.

05:13.520 --> 05:16.160
And now we're going to choose is jump is false.

05:16.160 --> 05:20.610
Basically once we set this jump parameter to uncheck basically means false.

05:20.610 --> 05:24.370
It's going to play the run animation clip of this player game object.

05:24.370 --> 05:24.770
Why?

05:24.970 --> 05:31.250
Because we can see we have chosen that condition once we going back to this run animation clip.

05:31.290 --> 05:37.010
As you can see in the inspector we have chosen, if jump is false, then we're gonna move over to this

05:37.010 --> 05:38.290
run animation clip.

05:38.450 --> 05:44.570
And if we just set this jump parameter to true, we're going to play this jump animation clip of this

05:44.570 --> 05:45.690
player game object.

05:45.730 --> 05:46.010
Why?

05:46.050 --> 05:50.410
Because we can see we have chosen that condition in the inspector.

05:50.410 --> 05:52.690
So let's try to check manually.

05:52.690 --> 05:56.850
So let's click on this play play a play button in the top.

05:56.850 --> 06:03.050
Let's click on this play button in the top and try to set this jump parameter manually to true or false

06:03.090 --> 06:04.690
means uncheck or check.

06:04.930 --> 06:09.210
We will see that now if I set this parameter to true basically means check.

06:09.250 --> 06:13.290
We can see this jump animation clip just plays right away.

06:13.290 --> 06:18.650
And once we set this jump parameter to false means uncheck, we can see the run animation.

06:18.650 --> 06:20.430
Once again it's playing.

06:20.430 --> 06:20.950
Why?

06:20.990 --> 06:25.230
Because we can see if we select the back transition, then go over to Inspector.

06:25.230 --> 06:25.870
Scroll down.

06:25.870 --> 06:26.910
We can see it.

06:26.950 --> 06:27.910
Jump is false.

06:27.910 --> 06:31.110
Then it's gonna play that run animation clip.

06:31.110 --> 06:36.950
And if jump is true, we can see it's gonna play this jump animation clip of this player.

06:36.990 --> 06:37.510
Game over.

06:37.590 --> 06:38.030
Sorry.

06:38.190 --> 06:42.790
Once we set this jump parameter to false, it's gonna play the run animation clip.

06:42.790 --> 06:48.710
And once we set a jump parameter to true, basically means it's going to play the jump animation clip

06:48.710 --> 06:49.510
right away.

06:49.510 --> 06:51.070
So let's get out of play mode.

06:51.070 --> 06:54.310
So we need to control those things with parameter.

06:54.310 --> 06:58.470
So if we select our player game object we can see in the inspector.

06:58.910 --> 07:04.550
We can see a animator component just added up right away once we created this animation clip.

07:04.550 --> 07:10.870
So once we created this run and this player jump animation clip of this player game object, this animator

07:10.870 --> 07:13.190
component, just add right away.

07:13.670 --> 07:15.470
So this animator component.

07:15.470 --> 07:19.950
So we need a reference of this animator component of this player game object.

07:19.950 --> 07:22.270
Then we can make transition between these.

07:22.830 --> 07:26.130
Or we can simply set this jump parameter through our code.

07:26.170 --> 07:28.250
Let's suppose we just press down space key.

07:28.290 --> 07:30.810
Then we want this player game object to jump.

07:30.890 --> 07:34.250
So in that moment we need to set this jump parameter to true.

07:34.290 --> 07:35.250
Basically means check.

07:35.250 --> 07:38.930
And we do know once we set it's going to play the jump animation clip.

07:39.010 --> 07:40.570
So how we can set that.

07:40.570 --> 07:44.530
If we select our player GameObject in the hierarchy then go over to Inspector.

07:44.570 --> 07:49.450
We can see an animator component just added once we created this animation clip.

07:49.450 --> 07:52.370
So we need a reference of this animator component.

07:52.370 --> 07:58.170
Then we can set this parameter to true or False depending upon what player actually doing.

07:58.170 --> 08:04.610
So we need a reference and we can see a plus icon just became a of in this animator component.

08:04.610 --> 08:10.530
So what we basically need to do we need to go over to overrides and then top up inspector overrides

08:10.530 --> 08:12.610
and then click on this apply all.

08:12.610 --> 08:19.090
So if I just move over to this project tab then assets and then prefabs or folder and open up the player

08:19.090 --> 08:22.890
prefab means copy of this game object by double clicking on it.

08:22.930 --> 08:27.030
We can not able to see in inspector any animator component.

08:27.070 --> 08:29.670
Added to this player game object.

08:29.670 --> 08:32.470
So what we basically need to do we need to go back.

08:32.790 --> 08:35.350
So in hierarchy you can see the back arrow.

08:35.350 --> 08:40.030
So just click click there in order to go back and then select this player game object.

08:40.030 --> 08:43.950
Then go over to Inspector Overrides and then click on Apply All.

08:43.990 --> 08:48.750
As soon as we click on Apply All the plus icon just gone by now.

08:48.750 --> 08:54.430
And if we now try to open up the player prefab from that folder by double clicking on it, we can see

08:54.470 --> 08:56.910
animator component is attached by.

08:56.950 --> 09:00.190
Now to this player game object.

09:00.190 --> 09:06.070
So what we basically need to do whatever changes we made in this hierarchy of this player game object

09:06.070 --> 09:12.710
in Inspector, we can just click on overrides and then apply all the changes we made in this player

09:12.750 --> 09:14.030
game object in hierarchy.

09:14.030 --> 09:20.550
It's going to be saved into prefab of this game object as well means copy of that game object.

09:20.550 --> 09:24.910
So make sure you just go to Inspector then overrides and then click on Apply Wall.

09:24.910 --> 09:30.870
So the changes you made over here, it's going to be saved into this player GameObject prefab as well.
