Join Jesse Freeman for an in-depth discussion in this video Making obstacles recyclable, part of Unity 5: 2D Essential Training (2015).
- Now we're ready to get instances…that have already been created…in our object pool and are deactivated…and reactivate them.…To do this, let's open back up…our Object Pool class.…Now, we're going to modify the next…object pool method in order to go through…the list of instances we've created…and see which ones have already been deactivated,…and then return those instead of creating new ones.…To get started, let's add some space…right below where we create our instance reference.…
We're going to use a foreach loop…to iterate through our pool of instances.…We're going to create a variable called go…representing a game object…inside of our pool of instances.…As we loop through this,…we're going to test each game object…to see if it's set to false.…Now since this is actually typed…to a recycled game object,…we're going to need to get a reference…of its own game object.…Then we can call activeself.…
Here we'll see if it's not set to true.…Now we can set the instance to the game object,…and we'll change the instance's transform position.…
Super Zombie Runner riffs off the popular endless runner genre: a one-button casual game that's not only fun to play but exciting to build. The focus of the work is a reusable code base that you can extend and make your own, while learning the basics of object pooling, supporting multiple screen resolutions, tracking scoring, and multi-platform publishing. Along the way, Jesse covers key Unity features, such as working with sprites, creating animations, and leveraging the UI components.
- Working with sprites and animation
- Creating the player
- Spawning GameObjects
- Adding obstacles and collisions
- Building the game objects and logic
- Managing game state
- Creating pixel-perfect cameras
- Designing for multiple screen resolutions
- Adding scores
- Optimizing performance
- Publishing to desktop, web, and mobile platforms
Skill Level Intermediate
1. Working with Sprites
2. Creating Repeating Textures
3. Creating Obstacles
4. Object Pooling
5. Creating the Player
6. Setting Up the Game
7. Adding UI
8. Creating More Obstacles
- 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.