WEBVTT

00:00.040 --> 00:01.080
We got the bucks.

00:01.120 --> 00:06.160
And, uh, what we have to do, we basically need to move over to our sample scene.

00:06.160 --> 00:09.320
Or in which scene we playing our game to do.

00:09.320 --> 00:15.160
So, we're gonna move over to our project app assets and then scenes folder, and we have the sample

00:15.160 --> 00:16.840
scene as you can notice.

00:16.840 --> 00:20.480
So let's double click on it in order to move over to that scene.

00:20.640 --> 00:25.480
Or you can just rename this scene something like 11 one by right clicking on it.

00:25.480 --> 00:29.920
In the top you can see rename and rename it to like level one.

00:29.920 --> 00:31.960
I'm gonna leave it with Sample Scene.

00:32.360 --> 00:34.640
It's basically up to you if you want.

00:35.040 --> 00:41.880
So the bug is that if we move over to hierarchy then canvas, and then we can select this game over

00:41.920 --> 00:47.360
UI and we can notice this, that we just disable this game over UI.

00:47.480 --> 00:50.800
So what we basically need to do we need to enable this to do.

00:50.800 --> 00:55.880
So we're gonna select our game over UI underneath our canvas in the hierarchy.

00:56.120 --> 00:58.280
Then go over to Inspector and check it.

00:58.280 --> 00:59.790
Basically enable that.

01:00.150 --> 01:06.430
And now if we go ahead and then click on this play button, you will be able to notice as soon as beginner

01:06.430 --> 01:14.270
loses all of our health, we should uh, that basically the game over UI, the BG just gonna pop up

01:14.590 --> 01:16.390
and we're gonna have to option.

01:16.390 --> 01:19.350
We're gonna have retry button and the menu button.

01:19.350 --> 01:26.150
So if I just lose all of my health, as you can notice, we just died.

01:26.150 --> 01:34.310
And as soon as we died, we can notice that this game over us gets pop up and it says, you lost.

01:34.310 --> 01:38.390
So we can just click on this retry button in order to reload the scene.

01:38.750 --> 01:43.310
Or if we click on this menu button, we just want to move over to menu scene.

01:43.470 --> 01:47.230
But the problem is that we not moving over to our menu scene.

01:47.230 --> 01:51.230
So if I just click on it, but we printing out a message.

01:51.230 --> 01:57.550
So if I move over to my console tab, we can see as soon as we clicking on this menu button.

01:57.550 --> 02:00.590
We getting a message says Load menu.

02:00.590 --> 02:06.190
So instead of printing out message, we basically need to move over to that menu scene.

02:06.190 --> 02:10.710
To do so, let's get out of play mode and let's open up our script.

02:10.750 --> 02:16.590
Basically, we can just double click on this, uh, on this message in order to move over to that line

02:16.630 --> 02:17.230
of code.

02:17.230 --> 02:20.070
So let's double click it, double click on this.

02:20.590 --> 02:24.350
And as you can notice we just printing out the message.

02:24.350 --> 02:30.470
So I'm going to leave this uh I just want to keep this uh, to print out the message.

02:30.710 --> 02:35.390
And also we need to load up that menu scene and we have it by now.

02:35.390 --> 02:42.870
So in order to load up that scene, we do know that we need to use this scene manager scene manager

02:43.030 --> 02:47.510
dot load scene function and this function in brackets in quotation.

02:47.510 --> 02:51.870
It's going to take the scene name or it's going to take the index of it.

02:51.870 --> 02:53.510
You can pass both of them.

02:53.550 --> 02:55.270
Basically it's up to you.

02:55.740 --> 03:02.820
So we need to check the, uh, the build index of that machine or the name of it.

03:02.820 --> 03:08.980
So to do, uh, to, to, uh, basically to check that we're going to move over to unity editor and

03:08.980 --> 03:13.780
the top left file, we're going to click on it and let's click on this build profile.

03:14.340 --> 03:17.420
And we're going to be in windows something over here.

03:17.420 --> 03:22.940
So just click on this open scene list and make sure you just drag your scene in this scene list.

03:22.940 --> 03:27.380
If you haven't drag it yet it's gonna give you some errors.

03:27.380 --> 03:31.260
So that's that's why you need to drag and you need to make sure.

03:31.460 --> 03:37.620
So what you have to do, you basically need to move over to your project app assets and move over to

03:37.660 --> 03:41.300
scenes folder or in which folder you created the scene.

03:41.500 --> 03:45.060
Then select that scene and drag it over to this scene list.

03:45.060 --> 03:52.700
So since I already dragged the scene, as you can notice, and we can see the, uh, index of it in

03:52.700 --> 03:54.620
the right section, which is zero.

03:54.620 --> 04:01.180
So we can simply pass the index of it or the name of the scene inside quotation and make sure you drag

04:01.180 --> 04:03.780
it all of the scenes inside this inlets.

04:03.820 --> 04:06.180
Else it's not gonna work at all.

04:06.180 --> 04:12.300
So you need to make sure that to make sure it you basically have to move over to top left file in the

04:12.460 --> 04:13.540
unity editor.

04:13.660 --> 04:18.140
Then click on this build profiles and you're gonna be windows in the left bar.

04:18.140 --> 04:19.940
You can notice it's active.

04:19.940 --> 04:23.980
And then click on this open scene list and you're gonna be over here.

04:24.020 --> 04:24.700
Same list.

04:24.700 --> 04:28.100
So make sure you drag all of the scenes right over here.

04:28.340 --> 04:30.780
So once we are done, we are completely done.

04:30.780 --> 04:34.980
We can click on this car tab in order to cut our that tab.

04:35.140 --> 04:41.500
And now we're gonna move over to our script and over here, uh, what we're going to do, we're going

04:41.500 --> 04:43.620
to pass the bill index of it.

04:43.620 --> 04:45.340
So we can simply pass zero.

04:45.340 --> 04:47.660
And we can close that off with semicolon.

04:47.660 --> 04:54.450
And we do know that, uh, if we pass zero and we have seen that zero index basically means our minus

04:54.450 --> 04:54.850
n.

04:54.850 --> 05:00.090
So whenever we're going to click on this panel button then this function just gonna trigger and this

05:00.090 --> 05:03.250
function basically load up the scene which is our panel.

05:03.490 --> 05:09.410
Or you can simply pass inside this quotation the name of the same scene and make sure you spelling it

05:09.410 --> 05:12.250
correct, else it's not gonna work at all.

05:12.250 --> 05:17.930
So I'm going to pass menu and let's press down Ctrl D or Ctrl S to save our script.

05:17.930 --> 05:19.770
And now let's move over to unity.

05:20.010 --> 05:27.930
So now if we click on that basically that menu button, we just gonna move over to our mano scene.

05:28.130 --> 05:33.410
And once we're gonna click on that play button, then we're just gonna move over to our sample scene

05:33.410 --> 05:37.050
or the, or you can simply say in the level one.

05:37.450 --> 05:39.290
So let's check that out.

05:39.530 --> 05:43.850
So I'm going to click on this play button in the top in order to play our game.

05:43.850 --> 05:45.850
And let's have a look on this.

05:46.770 --> 05:48.210
So just wait a moment.

05:49.650 --> 05:51.610
We're gonna test this out.

05:56.090 --> 05:59.410
Uh, so let's take damages.

06:02.050 --> 06:09.250
And we can see, uh, this, uh, this, uh, game over UI just gets pop up, basically the BG.

06:09.490 --> 06:12.930
And if I just go ahead and then click on this menu button.

06:13.410 --> 06:18.850
And as you can see, as soon as we just clicked on it, we just move it over to menus in.

06:18.850 --> 06:21.090
And we can notice in our hierarchy.

06:21.090 --> 06:27.130
So if we move over to hierarchy tab, we can see we we just move it over to this panel scene.

06:27.290 --> 06:29.090
Uh, as you can notice.

06:29.250 --> 06:36.650
And if we go ahead and then click on this play button, we can uh, we just gonna move over to our sample

06:36.690 --> 06:37.090
scene.

06:37.130 --> 06:42.170
Or as you can notice, we just move it over to level one or sample scene.

06:42.330 --> 06:47.530
So I hope you get the idea that how you can do it and we're gonna do a different thing.

06:47.530 --> 06:49.530
So I'm gonna get out of play mode.
