JetPool is a simple spawn pool class. It pools objects to be reused, letting you recycle them instead of calling Instantiate() and Destroy(), and thus increases performance. It should be used for things which are constantly spawned, like bullets or hit sparks.
public GameObject Spawn()
Spawns the object slotted into the “prefab” slot in the Inspector and returns the resulting GameObject.
public void Despawn(GameObject _object)
If this is passed a GameObject which this JetPool spawned, this will deactivate the GameObject and return it to the JetPool to be reused later.
public int ActiveObjects()
This returns the number of currently active GameObjects which this JetPool has spawned.
public GameObject prefab
The prefab that will be spawned.
public int startingPoolSize
The amount of the prefab Instantiated in Start(). This only references the starting amount of the prefab; the JetPool will spawn more if they are requested.