|
PoolGen
1.0
|
Manages multi-object pools More...
Inherits MonoBehaviour.
Classes | |
| class | PoolEvent |
Public Types | |
| enum | PoolInitializationType { Manual = 0, Awake = 1, Start = 2 } |
| How the ObjectPool should be initialized More... | |
Public Member Functions | |
| bool | ContainsPrefabID (int id) |
| Checks if PoolGenPrefabs contains a prefab with the specified id /summary> | |
| void | DespawnAll () |
| Despawn all spawned objects associated with this PoolManager More... | |
| void | DespawnAll (int prefabIndex) |
| Despawn all spawned objects with the specified prefab index that are associated with this PoolManager More... | |
| ObjectPool | GetObjectPool (int prefabID) |
| Gets an ObjectPool using the specified PoolPrefab.ID More... | |
| List< PoolUser > | GetPooledObjects () |
| Gets all pooled objects More... | |
| PoolUser[] | GetPooledObjects (int prefabIndex) |
| Gets all pooled objects using the specified prefab index More... | |
| int | GetSpawnedObjectCount (params int[] prefabIndices) |
| Gets all spawned objects with the specified prefab indices More... | |
| float | GetTotalPrefabWeight (bool includeInactive=false) |
| Adds up the weight of each PoolPrefab. Empty pools are not taken into consideration. More... | |
| float | GetTotalPrefabWeight (params int[] prefabIndices) |
| Adds up the weight of each PoolPrefab More... | |
| int | GetWeightedPrefabIndex (bool includeInactive=false) |
| Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| int | GetWeightedPrefabIndex (float value, bool includeInactive=false) |
| Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| int | GetWeightedPrefabIndex (bool includeInactive, params int[] prefabIndices) |
| Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| int | GetWeightedPrefabIndex (float value, bool includeInactive, params int[] prefabIndices) |
| Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| PoolPrefab | GetWeightedPrefab (bool includeInactive=false) |
| Gets a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| PoolPrefab | GetWeightedPrefab (float value, bool includeInactive=false) |
| Gets a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| PoolPrefab | GetWeightedPrefab (float value, bool includeInactive, params int[] prefabIndices) |
| Gets a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration. More... | |
| int | IndexFromPrefabID (int id) |
| Gets the index of a PoolPrefab based on its index in PoolGenPrefabs More... | |
| int | IndexFromPrefabName (string name) |
| Gets the index of a PoolPrefab based on its name More... | |
| void | Pool () |
| Pools a single random object More... | |
| PoolUser | Pool (int prefabIndex) |
| Pools a single object More... | |
| void | InitializePool (int prefabIndex, bool forceIfInactive=true) |
| Creates an ObjectPool fills its pool if it hasn't been created already More... | |
| void | InitializePools () |
| Creates an ObjectPool for each PoolPrefab in PoolGenPrefabs set to PoolInitializationType.Manual and fills its pool More... | |
| void | InitializePools (PoolInitializationType autoPoolType) |
| Creates an ObjectPool for each PoolPrefab in PoolGenPrefabs with the specified PoolInitializationType and fills its pool More... | |
| bool | IsObjectContainerInitialized (int prefabID) |
| Has the ObjectPool been created More... | |
| List< PoolUser > | SpawnAll () |
| Spawns an object for each prefab More... | |
| void | SpawnByName (string name) |
| Spawns an object by name More... | |
| PoolUser | Spawn () |
| Spawns an object based on weighted random chance More... | |
| PoolUser | Spawn (int prefabIndex) |
| Spawns an object based on the specified prefab index More... | |
| PoolUser | Spawn (Vector3 position, Quaternion rotation) |
| Spawns an object based on weighted random chance More... | |
| PoolUser | Spawn (int prefabIndex, Vector3 position, Quaternion rotation) |
| Spawns an object based on the specified prefab index More... | |
| PoolUser | WeightedSpawn (Vector3 position, Quaternion rotation, params int[] prefabIndices) |
| Spawns an object based on weighted random chance of the specified prefab indices More... | |
Static Public Member Functions | |
| static PoolManager | GetPool (string poolName, int poolIndex=0) |
| Gets a PoolManager by name (and index if multiple PoolManagers exist with the same name More... | |
| static List< PoolManager > | GetPools () |
| Get a list of all PoolManager More... | |
| static int | GetPoolCount () |
| Get a count of all PoolManager More... | |
| static int | GetPoolCount (string poolName) |
| Get a count of all PoolManager with the specified name More... | |
| static int | GetPoolIndex (PoolManager pool) |
| Get the index of the PoolManager in the list of PoolManager of the same name More... | |
| static List< PoolManager > | GetPoolList (string poolName, bool createIfNotFound=true) |
| Get a list of PoolManager of the same name More... | |
| static PoolUser | Spawn (string poolName, int poolIndex=0) |
| Spawn an object More... | |
| static PoolUser | Spawn (string poolName, int prefabIndex, int poolIndex=0) |
| Spawn an object More... | |
| static PoolUser | Spawn (string poolName, Vector3 position, Quaternion rotation, int poolIndex=0) |
| Spawn an object More... | |
| static PoolUser | Spawn (string poolName, int prefabIndex, Vector3 position, Quaternion rotation, int poolIndex=0) |
| Spawn an object More... | |
| static PoolUser | Spawn (PoolManager pool) |
| Spawn an object More... | |
| static PoolUser | Spawn (PoolManager pool, int prefabIndex) |
| Spawn an object More... | |
| static PoolUser | Spawn (PoolManager pool, Vector3 position, Quaternion rotation) |
| Spawn an object More... | |
| static PoolUser | Spawn (PoolManager pool, int prefabIndex, Vector3 position, Quaternion rotation) |
| Spawn an object More... | |
| static List< PoolUser > | SpawnAll (string poolName) |
| Spawn one of each More... | |
Properties | |
| bool | HideSpawnedObjects [get, set] |
| Hides objects in the hierarchy panel when spawned More... | |
| Dictionary< int, ObjectPool > | ObjectContainers [get, set] |
| Containers to be used as pools. There should be one for each PoolPrefab in PoolGenPrefabs More... | |
| PoolEvent | OnDespawn [get, set] |
| Fires when an object is despawned More... | |
| PoolEvent | OnPool [get, set] |
| Fires when an object is pooled More... | |
| PoolEvent | OnSpawn [get, set] |
| Fires when an object is spawned More... | |
| int | PrefabCount [get] |
| How many prefabs are in PoolGenPrefabs More... | |
| int | PooledObjectsCount [get] |
| How many objects are pooled total More... | |
| List< PoolPrefab > | PoolGenPrefabs [get, set] |
| Poolable object data More... | |
| string | PoolName [get, set] |
| Name of this PoolManager More... | |
| int | SpawnedObjectsCount [get] |
| How many objects are spawned total More... | |
Manages multi-object pools
How the ObjectPool should be initialized
| Enumerator | |
|---|---|
| Manual |
The pool has to be initialized by YOU manually through code |
| Awake |
The pool will be initialized on Awake() |
| Start |
The pool will be initialized on Start() |
| void DespawnAll | ( | ) |
Despawn all spawned objects associated with this PoolManager
| void DespawnAll | ( | int | prefabIndex | ) |
Despawn all spawned objects with the specified prefab index that are associated with this PoolManager
| ObjectPool GetObjectPool | ( | int | prefabID | ) |
Gets an ObjectPool using the specified PoolPrefab.ID
|
static |
Gets a PoolManager by name (and index if multiple PoolManagers exist with the same name
|
static |
Get a count of all PoolManager
|
static |
Get a count of all PoolManager with the specified name
| List<PoolUser> GetPooledObjects | ( | ) |
Gets all pooled objects
| PoolUser [] GetPooledObjects | ( | int | prefabIndex | ) |
Gets all pooled objects using the specified prefab index
|
static |
Get the index of the PoolManager in the list of PoolManager of the same name
|
static |
Get a list of PoolManager of the same name
|
static |
Get a list of all PoolManager
| int GetSpawnedObjectCount | ( | params int[] | prefabIndices | ) |
Gets all spawned objects with the specified prefab indices
| float GetTotalPrefabWeight | ( | bool | includeInactive = false | ) |
Adds up the weight of each PoolPrefab. Empty pools are not taken into consideration.
| float GetTotalPrefabWeight | ( | params int[] | prefabIndices | ) |
Adds up the weight of each PoolPrefab
| PoolPrefab GetWeightedPrefab | ( | bool | includeInactive = false | ) |
Gets a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| PoolPrefab GetWeightedPrefab | ( | float | value, |
| bool | includeInactive = false |
||
| ) |
Gets a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| PoolPrefab GetWeightedPrefab | ( | float | value, |
| bool | includeInactive, | ||
| params int[] | prefabIndices | ||
| ) |
Gets a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| int GetWeightedPrefabIndex | ( | bool | includeInactive = false | ) |
Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| int GetWeightedPrefabIndex | ( | float | value, |
| bool | includeInactive = false |
||
| ) |
Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| int GetWeightedPrefabIndex | ( | bool | includeInactive, |
| params int[] | prefabIndices | ||
| ) |
Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| int GetWeightedPrefabIndex | ( | float | value, |
| bool | includeInactive, | ||
| params int[] | prefabIndices | ||
| ) |
Gets the index of a PoolPrefab based on weighted random chance. Empty pools are not taken into consideration.
| int IndexFromPrefabID | ( | int | id | ) |
Gets the index of a PoolPrefab based on its index in PoolGenPrefabs
| int IndexFromPrefabName | ( | string | name | ) |
Gets the index of a PoolPrefab based on its name
| void InitializePool | ( | int | prefabIndex, |
| bool | forceIfInactive = true |
||
| ) |
Creates an ObjectPool fills its pool if it hasn't been created already
| void InitializePools | ( | ) |
Creates an ObjectPool for each PoolPrefab in PoolGenPrefabs set to PoolInitializationType.Manual and fills its pool
| void InitializePools | ( | PoolInitializationType | autoPoolType | ) |
Creates an ObjectPool for each PoolPrefab in PoolGenPrefabs with the specified PoolInitializationType and fills its pool
| bool IsObjectContainerInitialized | ( | int | prefabID | ) |
Has the ObjectPool been created
| void Pool | ( | ) |
Pools a single random object
| PoolUser Pool | ( | int | prefabIndex | ) |
Pools a single object
| PoolUser Spawn | ( | ) |
Spawns an object based on weighted random chance
| PoolUser Spawn | ( | int | prefabIndex | ) |
Spawns an object based on the specified prefab index
| PoolUser Spawn | ( | Vector3 | position, |
| Quaternion | rotation | ||
| ) |
Spawns an object based on weighted random chance
| PoolUser Spawn | ( | int | prefabIndex, |
| Vector3 | position, | ||
| Quaternion | rotation | ||
| ) |
Spawns an object based on the specified prefab index
|
static |
Spawn an object
|
static |
Spawn an object
|
static |
Spawn an object
|
static |
Spawn an object
|
static |
Spawn an object
|
static |
Spawn an object
|
static |
Spawn an object
|
static |
Spawn an object
| List<PoolUser> SpawnAll | ( | ) |
Spawns an object for each prefab
|
static |
Spawn one of each
| void SpawnByName | ( | string | name | ) |
Spawns an object by name
| PoolUser WeightedSpawn | ( | Vector3 | position, |
| Quaternion | rotation, | ||
| params int[] | prefabIndices | ||
| ) |
Spawns an object based on weighted random chance of the specified prefab indices
|
getset |
Hides objects in the hierarchy panel when spawned
|
getset |
Containers to be used as pools. There should be one for each PoolPrefab in PoolGenPrefabs
|
getset |
Fires when an object is despawned
|
getset |
Fires when an object is pooled
|
getset |
Fires when an object is spawned
|
get |
How many objects are pooled total
|
getset |
Poolable object data
|
getset |
Name of this PoolManager
|
get |
How many prefabs are in PoolGenPrefabs
|
get |
How many objects are spawned total
1.8.6