void CreatePrefabPool(Transform prefab)
Description
Creates a new PrefabPool in this SpawnPool to allow prefab-specific options, such as preloading. This function should only be used once and only if you need to use the options or static access later:
Note on preloading:If preload amount is 0, nothing will be spawned and the return list will be empty, but any other settings will be applied as expected. // Create a prefab pool, set culling options but don't need to pre-load any
PrefabPool prefabPool = new PrefabPool(enemyPrefab);
prefabPool.preloadAmount = 1; // Recommended to pre-load at least 1
prefabPool.cullDespawned = true;
prefabPool.cullAbove = 40;
prefabPool.cullDelay = 5;
prefabPool.cullMaxPerPass = 5; // This is the default so may be omitted
prefabPool.limitInstances = false; // This is the default so may be omitted
prefabPool.limitAmount = 0; // This is the default so may be omitted
// Enemies is just an example. Any SpawnPool is fine.
PoolManager.Pools["Enemies"].CreatePrefabPool(prefabPool);
// Later, just use as normal...
PoolManager.Pools["Enemies"].Spawn(enemyPrefab);
|
Code Reference > SpawnPool >