Lesson 4: Object Pooling

In this lesson, we’ll learn about Object Pooling. Basically we’re going to recycle our Game Objects to save on overhead.

4.1: GameObjectsUtil.cs

4.1:Spawner.cs

In this section, only modify the highlighted line (line 24).

4.1: DestroyOffscreen.cs

In this section, only modify the highlighted line (line 24).


4.2: RecycleGameObjects.cs

4.2: GameObjectUtil.cs


4.3: ObjectPool.cs


4.4: GameObjectUtil.cs


4.5: ObjectPool.cs


4.6: RecycleGameObject.cs


4.7: Obstacle.cs


4.8: RecycleGameObject.cs

4.8: Obstacle.cs