In this video, Jesse Freeman teaches you how to dynamically add the player to the endless runner game loop. You'll use the object pool to instantiate a new instance of the player. This will be important starting and restarting the game. Learning how build a game loop in Unity 5 is an import skills for building a 2D game.
- [Voiceover] Now that we have the basics…of our Game Manager in place,…let's look into how we can set up our game.…We're gonna create a method called ResetGame…that'll get called whenever we wanna create a new game.…In this case, it's simply gonna turn the spawner on…and we're gonna get a reference to the player,…either from the object pool,…or have the object pool create a new player for us.…First, let's select the player instance in the scene…and select Apply to its prefab…to make sure that any changes we've made…are now saved to the prefab.…
Then we're gonna delete it from the scene.…Next, let's select the Game Manager…and double-click on the Game Manager script…to open it up in MonoDevelop.…At this point, we now know that the floor…and the spawner are going to work…by getting our own reference during the Awake method.…So let's make these two properties private…so we don't see them in the Inspector.…Above this, we're gonna need a reference…to the playerPrefab so we can actually create it…when we reset our game.…
Start watching to learn how to convert artwork into sprites, create repeating background textures with Unity's TexturePacker, and build reusable game objects such as players, obstacles, and enemies. Jesse also covers the basics of object pooling, working with custom UI components, and multiplatform publishing.
- Importing artwork
- Editing sprites
- Creating repeating background textures
- Building reusable obstacles
- Recycling game objects
- Building an object pool
- Creating the player
- Starting and ending the game
- Displaying and saving the score
- Adding menus and text
- Publishing a Unity game in different formats
Skill Level Beginner
1. Working with Sprites
2. Creating Repeating Textures
3. Creating Obstacles
4. Object Pooling
5. Creating the Player
6. Setting Up the Game
7. Polishing the Game
8. Creating More Obstacles
Publish to different formats5m 42s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.