Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Unity Basics!
You have completed Unity Basics!
Preview
Now that we know when the player hits a pipe, let’s reload the game so that they can start over.
Unity 6 Documentation
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Now we need to end the run for the player
so that they can't keep playing forever.
0:00
For now, I'm
going to simply reload the scene
0:01
so that they immediately start over.
0:03
It's going to feel a bit abrupt,
but in the next stage
0:05
we're going to polish up our game
and we'll implement a nice simple menu
0:08
for the player to restart
when they're ready.
0:12
Now we could add this scene
reloading logic
0:14
directly in our OnCollisionEnter2D
method in the Player script.
0:17
But I was thinking ahead a bit,
0:21
and I think it's time to create
an overall game manager script.
0:22
These are pretty common in games
and handle overall game logic
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up