We'll come back.
And this video, we are going to add the game over scene to our game.
So let's simply reproduce this main menu or duplicate it.
So copy and paste in windows and duplicate with Command D in Macintosh.
So let's change the name from main menu to game over and now let's open up the scene.
So instead of Pong, we want to have game over here as a text.
So let's change that.
Let's change the title from Pong to game over.
And now of course, the size is not enough anymore.
So let's change the width to 700 and center the text.
It's centered, it's good.
And now we can replace it a little bit.
So let's replace that component to the center.
And instead of play we can say something like replay.
So here we simply say replay.
And now let's have a look at the button functionality.
It says Play game and that's the script here, play button, play game.
Let's have a look at the script once again, what it does just to make sure that it simply moves over
to the other scene and then we can simply reproduce that or re-use that.
All right.
That's perfect.
It says scene manager load scene game.
That's exactly what we want.
All right.
So what we need to do, however, is to find a way to get from our game scene to this game over scene.
So, first of all, let's save the scene with command s or control as or with file save scenes.
And then let's go to our main menu, then let's go to our game.
And actually we need to open the script that controls the score.
So let's open up score controller.
And then here we have this debug log that says Game one.
And in here we want to move from this scene to or from the game scene to the game over scene.
So using unity engine, that scene management.
So we need to have this namespace again because in scene management we will find the scene manager,
so scene manager and then we want to load a scene.
So let's enter load scene and here we enter the scene name and it's just game over.
Let's save that and let's give it a try first.
So let's test it actually.
Let's change the condition to win the game because currently it's a lot higher.
So let's change this goal to win to let's say one.
So let's have a quick try to see if that works out.
So let's not move at all and see if we get to the next scene and there you are.
Nothing happens.
And if we look at the error, it says Scene game over, could not be loaded because it has not been
added to the build settings.
All right.
We have had that error before.
And if you want to make sure that game over works, you have to add the scene.
So let's go to a project in the background to the assets.
And here let's go to game over and add this scene to your scenes and build.
Okay.
Now we can try it again.
And that error should disappear and we should move from this scene to the next scene.
So let's have a look.
And we see game over now we can replay and we get back to the game.
If you want to show.
Let's say that real quick.
All right.
So now you have seen how you can create a game over.
Real quickly, if you want to show which player has won, you can use player press or you could use,
for example, don't destroy a load.
So static variables, we're going to do that in one of the later projects.
I wanted to keep this project real simple because you have already learned plenty of concepts in this
game.
You can, however, come back later on and apply those new concepts that you will learn in further chapters
to this game.
Great.
So see you in the next video.