Join Jesse Freeman for an in-depth discussion in this video Wiring up the object pool, part of Unity 5: 2D Essential Training (2015).
- So now that we have our ObjectPool,…let's look at how to connect it up…into our GameObject utility.…We'll open up the GameObject utility,…and start adding in the code we need.…Now we'll wanna manage all of the object pools in our game.…In order to do this, we're gonna create…something called a dictionary.…A dictionary allows us to have a key and a value.…In this case, we're gonna type the key…to a specific type of prefab, and the value will match…to the corresponding pool.…
This will help us look up where each of the pools are…whenever we need to create a new instance.…In order to do this, we're gonna need to import…the generic collections again,…so copy the System.Collections line.…And add in Generic.…Now let's add the following property…to the top of our utility.…Now it's important to note that since…both of these methods are static,…and we want this class to be completely static,…we're gonna have to also make our property static as well.…
This way, they will always be stored inside of the reference…of the class itself, since we're never creating an instance…
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?
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.