Tutorial by Examples

Sometimes when you make a game you need to create and destroy a lot of objects of the same type over and over again. You can simply do this by making a prefab and instantiate/destroy this whenever you need to, however, doing this is inefficient and can slow your game down. One way to get around thi...
Below is an example of an object pool that allows renting and returning of a given object type. To create the object pool a Func for the create function and an Action to destroy the object are required to give the user flexibility. On requesting an object when the pool is empty a new object will be ...
Another example: a Weapon that shoots out Bullets. The Weapon acts as an object pool for the Bullets it creates. public class Weapon : MonoBehaviour { // The Bullet prefab that the Weapon will create public Bullet bulletPrefab; // This List is our object pool, which starts...

Page 1 of 1