We got the bucks.
And, uh, what we have to do, we basically need to move over to our sample scene.
Or in which scene we playing our game to do.
So, we're gonna move over to our project app assets and then scenes folder, and we have the sample
scene as you can notice.
So let's double click on it in order to move over to that scene.
Or you can just rename this scene something like 11 one by right clicking on it.
In the top you can see rename and rename it to like level one.
I'm gonna leave it with Sample Scene.
It's basically up to you if you want.
So the bug is that if we move over to hierarchy then canvas, and then we can select this game over
UI and we can notice this, that we just disable this game over UI.
So what we basically need to do we need to enable this to do.
So we're gonna select our game over UI underneath our canvas in the hierarchy.
Then go over to Inspector and check it.
Basically enable that.
And now if we go ahead and then click on this play button, you will be able to notice as soon as beginner
loses all of our health, we should uh, that basically the game over UI, the BG just gonna pop up
and we're gonna have to option.
We're gonna have retry button and the menu button.
So if I just lose all of my health, as you can notice, we just died.
And as soon as we died, we can notice that this game over us gets pop up and it says, you lost.
So we can just click on this retry button in order to reload the scene.
Or if we click on this menu button, we just want to move over to menu scene.
But the problem is that we not moving over to our menu scene.
So if I just click on it, but we printing out a message.
So if I move over to my console tab, we can see as soon as we clicking on this menu button.
We getting a message says Load menu.
So instead of printing out message, we basically need to move over to that menu scene.
To do so, let's get out of play mode and let's open up our script.
Basically, we can just double click on this, uh, on this message in order to move over to that line
of code.
So let's double click it, double click on this.
And as you can notice we just printing out the message.
So I'm going to leave this uh I just want to keep this uh, to print out the message.
And also we need to load up that menu scene and we have it by now.
So in order to load up that scene, we do know that we need to use this scene manager scene manager
dot load scene function and this function in brackets in quotation.
It's going to take the scene name or it's going to take the index of it.
You can pass both of them.
Basically it's up to you.
So we need to check the, uh, the build index of that machine or the name of it.
So to do, uh, to, to, uh, basically to check that we're going to move over to unity editor and
the top left file, we're going to click on it and let's click on this build profile.
And we're going to be in windows something over here.
So just click on this open scene list and make sure you just drag your scene in this scene list.
If you haven't drag it yet it's gonna give you some errors.
So that's that's why you need to drag and you need to make sure.
So what you have to do, you basically need to move over to your project app assets and move over to
scenes folder or in which folder you created the scene.
Then select that scene and drag it over to this scene list.
So since I already dragged the scene, as you can notice, and we can see the, uh, index of it in
the right section, which is zero.
So we can simply pass the index of it or the name of the scene inside quotation and make sure you drag
it all of the scenes inside this inlets.
Else it's not gonna work at all.
So you need to make sure that to make sure it you basically have to move over to top left file in the
unity editor.
Then click on this build profiles and you're gonna be windows in the left bar.
You can notice it's active.
And then click on this open scene list and you're gonna be over here.
Same list.
So make sure you drag all of the scenes right over here.
So once we are done, we are completely done.
We can click on this car tab in order to cut our that tab.
And now we're gonna move over to our script and over here, uh, what we're going to do, we're going
to pass the bill index of it.
So we can simply pass zero.
And we can close that off with semicolon.
And we do know that, uh, if we pass zero and we have seen that zero index basically means our minus
n.
So whenever we're going to click on this panel button then this function just gonna trigger and this
function basically load up the scene which is our panel.
Or you can simply pass inside this quotation the name of the same scene and make sure you spelling it
correct, else it's not gonna work at all.
So I'm going to pass menu and let's press down Ctrl D or Ctrl S to save our script.
And now let's move over to unity.
So now if we click on that basically that menu button, we just gonna move over to our mano scene.
And once we're gonna click on that play button, then we're just gonna move over to our sample scene
or the, or you can simply say in the level one.
So let's check that out.
So I'm going to click on this play button in the top in order to play our game.
And let's have a look on this.
So just wait a moment.
We're gonna test this out.
Uh, so let's take damages.
And we can see, uh, this, uh, this, uh, game over UI just gets pop up, basically the BG.
And if I just go ahead and then click on this menu button.
And as you can see, as soon as we just clicked on it, we just move it over to menus in.
And we can notice in our hierarchy.
So if we move over to hierarchy tab, we can see we we just move it over to this panel scene.
Uh, as you can notice.
And if we go ahead and then click on this play button, we can uh, we just gonna move over to our sample
scene.
Or as you can notice, we just move it over to level one or sample scene.
So I hope you get the idea that how you can do it and we're gonna do a different thing.
So I'm gonna get out of play mode.