In this video, Jesse Freeman teaches you how to create the core game loop you'll need to start the actual game. This game loop is critical in endless runners so you can allow the player to quickly start a game from when it opens to when they die and want to restart. Learning how build a game loop in Unity 5 is an import skills for building a 2D game.
- [Voiceover] So now that we have everything…in our game running, let's create a class…that'll help manage the actual game state itself.…Inside of our Scripts folder, let's create a new script,…and we're gonna call this GameManager.…Then, in our scene, we're gonna create an Empty GameObject.…Here, we'll call this GameManager,…and then we're also gonna give it a label.…Then, before we actually start…editing the code in the GameManager,…let's drag the GameManager script…over to the GameManager object.…
Here you'll see it's been attached,…and we can open this up inside of MonoDevelop.…Now we're gonna need two things…for our GameManager to get started.…First, we're gonna want to reposition the floor…towards the bottom of the screen,…no matter what the resolution is.…And second, we're gonna want a reference to the spawner,…so that we can turn it off when the game first begins.…Here we'll create a public property called GameObject,…and we're gonna call this floor.…Next, we'll create a new public property typed to a Spawner,…
Author
Released
8/22/2016Start 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
Duration
Views
Related Courses
-
Unity: Debugging Scripts
with Chris Byers1h 4m Intermediate -
Unity 5: 2D Optimizing Graphics
with Jesse Freeman28m 2s Intermediate -
Unity 5: 2D Advanced UI
with Jesse Freeman2h 19m Intermediate
-
Introduction
-
Welcome48s
-
-
1. Working with Sprites
-
Import artwork4m 40s
-
Cut up sprites5m 28s
-
Optimize loose sprites3m 10s
-
Build a pixel perfect camera6m 54s
-
-
2. Creating Repeating Textures
-
Build a repeat background4m 20s
-
Emulate parallax scrolling5m 21s
-
-
3. Creating Obstacles
-
Move obstacles3m 21s
-
Spawn new obstacles4m 25s
-
Random spawner delay times3m 45s
-
Destroy obstacles offscreen5m 50s
-
4. Object Pooling
-
Recycle game objects4m 23s
-
Build an object pool5m 37s
-
Wire up the object pool5m 23s
-
Make obstacles recyclable3m 19s
-
Clean up the obstacles5m 9s
-
5. Creating the Player
-
Build the player3m 14s
-
Make the player jump4m 32s
-
Player animation manager3m 19s
-
Recycle player4m 41s
-
-
6. Setting Up the Game
-
Start the game5m 28s
-
Add the player3m 30s
-
End the game5m 39s
-
Add a game over effect6m 56s
-
Restart the game4m 10s
-
-
7. Polishing the Game
-
Add text4m 46s
-
Lay out text4m 18s
-
Display the score2m 56s
-
Save high scores4m 37s
-
-
8. Creating More Obstacles
-
Add zombies3m 15s
-
Add in animated obstacles7m 28s
-
-
9. Publishing
-
Publish to different formats5m 42s
-
-
Conclusion
-
Next steps40s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Start the game