Join Jesse Freeman for an in-depth discussion in this video Implementing recycle in any script, part of Unity 5: 2D Essential Training (2015).
- Now our object pool system is working really well,…and we can as simply attach…a recycled GameObject script…to any GameObject we want to add to the pool.…But what happens in other scripts…when we restart a GameObject…that's being recycled?…Right now, there's no way to actually call Restart,…or Shutdown on other scripts.…In order to do that,…we're going to modify the way that our recycle script works…to look for other scripts that it will need to reset…whenever it gets reset itself.…
Let's open up the recycled GameObject's script.…Now, one of the ways that we can actually implement this…is by using something called the interface.…An interface is like a type of contract…that ensures that a class that uses it…will always have the same type of public methods.…Here, above our recycled GameObject,…we're going to create a new public interface,…and we're going to call this interface…IRecycle.…Now, the two methods that we use…inside of our recycled GameObject script…are Restart and Shutdown.…
So let's put them into our IRecycled interface.…
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.