.Pools.Create()

SpawnPool Create(string poolName)

Description
Creates a new pool in PoolManager.Pools which can then be accessed using the PoolName (the name of the pool).

This creates a new GameObject in the scene and adds the SpawnPool component to it. The GameObject will be named poolName+"Pool" for convenience.

You only need to use this if you need to create a pool via script. Otherwise, add a component to a GameObject in your scene to achieve the same result.

There can only be one pool with a particular name, so be sure to use this function in a place which is only run once.

// Create the pool (The GameObject will be named "EnemiesPool" in this example)
PoolManager
.Pools.Create("Enemies");

// Use the pool: Pass a reference of a prefab to create a PrefabPool + spawn
PoolManager
.Pools["
Enemies"].Spawn(myPrefab);




SpawnPool Create(string poolName, GameObject owner)

Description
Creates a new pool in PoolManager.Pools which can then be accessed using the PoolName (the name of the pool). 

Creates a SpawnPool Component on an 'owner' GameObject which registers itself with the PoolManager.Pools dictionary. The SpawnPool can then be accessed directly via the return value of this function or via the PoolManager.Pools dictionary.

You only need to use this if you need to create a pool via script. Otherwise, add a component to a GameObject in your scene to achieve the same result.

There can only be one pool with a particular name, so be sure to use this function in a place which is only run once.

// Create the pool. This example assumes it is in a component that needs to 
//    add a pool to its own GameObject
SpawnPool 
pool =
 PoolManager
.Pools.Create("Enemies", this.gameObject);

// Use the pool as shown in the overload above or directly via the return value.
pool.Spawn(myPrefab);