Pool Boss  V 1.2.1
The ultimate pooling solution!
DarkTonic.PoolBoss.PoolBoss Class Reference

This class is used to spawn and despawn things using pooling (avoids Instantiate and Destroy calls). More...

Inheritance diagram for DarkTonic.PoolBoss.PoolBoss:

Static Public Member Functions

static void Initialize ()
 Called automatically by default. If you uncheck "Create Items On Start", you will need to call this after your client has joined the room so they have Pool Boss. More...
 
static void RegisterPotentialInScenePoolable (PoolableInfo poolable)
 This is called by PoolableInfo components on objects that begin in the Scene, so Pool Boss will know about them and put them in the "Spawned" list. More...
 
static void UnregisterNonStartInScenePoolable (PoolableInfo poolable)
 This is called by PoolableInfo components that get spawned, so we know to remove them from the in scene objects list. More...
 
static void DestroyAllItemsAndReleaseMemory ()
 Call this method before changing to a Scene where Pool Boss would be automatically destroyed if you need to reclaim the memory from Addressables. More...
 
static void CreateNewPoolItem (Transform itemTrans, int preloadInstances, bool canInstantiateMore, int hardLimit, bool logMsgs, string catName, PrefabSource prefabSource, bool isTemporary=false, Action itemCreatedCallback=null)
 This method allows you to add a new Pool Item at runtime. More...
 
static Transform SpawnOutsidePool (string itemName, Vector3 position, Quaternion rotation)
 Call this method to spawn a prefab using Pool Boss, which will be spawned with no parent Transform (outside the pool) More...
 
static Transform SpawnOutsidePool (Transform transToSpawn, Vector3 position, Quaternion rotation)
 Call this method to spawn a prefab using Pool Boss, which will be spawned with no parent Transform (outside the pool) More...
 
static Transform SpawnInPool (string itemName, Vector3 position, Quaternion rotation)
 Call this method to spawn a prefab using Pool Boss, which will be a child of the Pool Boss prefab. More...
 
static Transform SpawnInPool (Transform transToSpawn, Vector3 position, Quaternion rotation)
 Call this method to spawn a prefab using Pool Boss, which will be a child of the Pool Boss prefab. More...
 
static Transform Spawn (Transform transToSpawn, Vector3 position, Quaternion rotation, Transform parentTransform)
 Call this method to spawn a prefab using Pool Boss. All the Spawners and Killable use this method. More...
 
static Transform Spawn (string itemName, Vector3 position, Quaternion rotation, Transform parentTransform)
 Call this method to spawn a prefab using Pool Boss. All the Spawners and Killable use this method. More...
 
static int CategoryItemsDespawned (string category)
 This method returns the number of items in a category that are currently despawned. More...
 
static List< Transform > CategoryItemsDespawnedList (string category)
 return a list of all available despawned clones in a category More...
 
static List< Transform > CategoryActiveItems (string category)
 This method returns a list of active items in a category. More...
 
static int CategoryItemsSpawned (string category)
 This method returns the number of items in a category that are currently spawned. More...
 
static bool Despawn (Transform transToDespawn, bool keepParent=false)
 Call this method to despawn a prefab using Pool Boss. All the Spawners and Killable use this method. More...
 
static void DespawnAllPrefabs ()
 This method will despawn all spawned instances of prefabs. More...
 
static void DespawnAllPrefabsInCategory (string category)
 This method will Despawn all spawned instances of all prefabs in a single category. More...
 
static void DespawnAllOfPrefab (Transform transToDespawn)
 This method will despawn all spawned instances of the prefab you pass in. More...
 
static void DestroyPoolItem (Transform transDeadItem, PrefabSource prefabSource)
 Destroys the pool item, and all prefabs from it that are already spawned. You should never call this except maybe during a new Scene load when you no longer need an item. More...
 
static void DestroyCategoryPoolItems (string categoryName)
 Destroys all pool items in the category specified, and all prefabs from it that are already spawned. You should never call this except maybe during a new Scene load when you no longer need all items in a category. More...
 
static Transform NextPoolItemToSpawn (Transform trans)
 Call this get the next available item to spawn for a pool item. More...
 
static Transform NextPoolItemToSpawn (string itemName)
 Call this get the next available item to spawn for a pool item. More...
 
static PoolItemInstanceList PoolItemInfoByName (string poolItemName)
 Call this method get info on a Pool Boss item (number of spawned and despawned copies, allow instantiate more, log etc). More...
 
static bool PrefabIsInPool (Transform trans)
 Call this method determine if the item (Transform) you pass in is set up in Pool Boss. More...
 
static bool PrefabIsInPool (string transName)
 Call this method determine if the item name you pass in is set up in Pool Boss. More...
 
static int PrefabDespawnedCount (Transform transPrefab)
 This will tell you how many available clones of a prefab are despawned and ready to spawn. A value of -1 indicates an error More...
 
static int PrefabSpawnedCount (Transform transPrefab)
 This will tell you how many clones of a prefab are already spawned out of Pool Boss. A value of -1 indicates an error More...
 
static bool AllOfPrefabAreDespawned (Transform transPrefab)
 Call this method to find out if all are despawned More...
 
static string GetPrefabName (Transform trans)
 This will return the name of the game object's prefab without "(Clone X)" in the name. It is used internally by PoolBoss for a lot of things. More...
 
static string GetPrefabName (GameObject go)
 This will return the name of the game object's prefab without "(Clone X)" in the name. It is used internally by PoolBoss for a lot of things. More...
 
static string GetPrefabShortName (string prefabName)
 This will return the name of the game object's prefab without "(Clone X)" in the name. More...
 
static bool IsSpawned (GameObject go)
 Returns whether a specified Game Object is spawned. If not, the it's available to spawn. More...
 

Properties

static int PrefabCount [get]
 This property will tell you how many different items are set up in Pool Boss. More...
 
static bool IsReady [get]
 This property is set to true when all pool items are ready to spawn. More...
 

Detailed Description

This class is used to spawn and despawn things using pooling (avoids Instantiate and Destroy calls).

Member Function Documentation

static bool DarkTonic.PoolBoss.PoolBoss.AllOfPrefabAreDespawned ( Transform  transPrefab)
static

Call this method to find out if all are despawned

Parameters
transPrefabThe transform of the prefab you are asking about.
Returns
Boolean value.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.AllOfPrefabAreDespawned().

static List<Transform> DarkTonic.PoolBoss.PoolBoss.CategoryActiveItems ( string  category)
static

This method returns a list of active items in a category.

Returns
The active items.
Parameters
categoryCategory name
static int DarkTonic.PoolBoss.PoolBoss.CategoryItemsDespawned ( string  category)
static

This method returns the number of items in a category that are currently despawned.

Parameters
categoryCategory name
Returns
integer
static List<Transform> DarkTonic.PoolBoss.PoolBoss.CategoryItemsDespawnedList ( string  category)
static

return a list of all available despawned clones in a category

Parameters
categoryCategory name
Returns
static int DarkTonic.PoolBoss.PoolBoss.CategoryItemsSpawned ( string  category)
static

This method returns the number of items in a category that are currently spawned.

Parameters
categoryCategory name
Returns
integer
static void DarkTonic.PoolBoss.PoolBoss.CreateNewPoolItem ( Transform  itemTrans,
int  preloadInstances,
bool  canInstantiateMore,
int  hardLimit,
bool  logMsgs,
string  catName,
PrefabSource  prefabSource,
bool  isTemporary = false,
Action  itemCreatedCallback = null 
)
static

This method allows you to add a new Pool Item at runtime.

Parameters
itemTransThe Transform of the item.
preloadInstancesThe number of instances to preload.
canInstantiateMoreCan instantiate more or not
hardLimitItem Hard Limit
logMsgsLog messages during spawn and despawn.
catNameCategory name
prefabSourcePrefab source
isTemporaryDo not pass this, used by PoolMiniBoss
itemCreatedCallbackDo not pass this, used by PoolMiniBoss

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.CreateNewPoolItem().

static bool DarkTonic.PoolBoss.PoolBoss.Despawn ( Transform  transToDespawn,
bool  keepParent = false 
)
static

Call this method to despawn a prefab using Pool Boss. All the Spawners and Killable use this method.

Parameters
transToDespawnTransform to despawn
keepParentSpecify true if you want the Game Object to stay where it is in the Hierarch (necessary for UI and come other components)
Returns
true if despawned

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.Despawn().

static void DarkTonic.PoolBoss.PoolBoss.DespawnAllOfPrefab ( Transform  transToDespawn)
static

This method will despawn all spawned instances of the prefab you pass in.

Parameters
transToDespawnTransform component of a prefab

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.DespawnAllOfPrefab(), and DarkTonic.PoolBoss.PoolMiniBoss.RemoveItems().

static void DarkTonic.PoolBoss.PoolBoss.DespawnAllPrefabs ( )
static

This method will despawn all spawned instances of prefabs.

static void DarkTonic.PoolBoss.PoolBoss.DespawnAllPrefabsInCategory ( string  category)
static

This method will Despawn all spawned instances of all prefabs in a single category.

Parameters
categoryCategory name to affect
static void DarkTonic.PoolBoss.PoolBoss.DestroyAllItemsAndReleaseMemory ( )
static

Call this method before changing to a Scene where Pool Boss would be automatically destroyed if you need to reclaim the memory from Addressables.

static void DarkTonic.PoolBoss.PoolBoss.DestroyCategoryPoolItems ( string  categoryName)
static

Destroys all pool items in the category specified, and all prefabs from it that are already spawned. You should never call this except maybe during a new Scene load when you no longer need all items in a category.

Parameters
categoryNameCategory to destroy items of.
static void DarkTonic.PoolBoss.PoolBoss.DestroyPoolItem ( Transform  transDeadItem,
PrefabSource  prefabSource 
)
static

Destroys the pool item, and all prefabs from it that are already spawned. You should never call this except maybe during a new Scene load when you no longer need an item.

Parameters
transDeadItemTrans dead item
prefabSourcePass in "Addressable" if you are destroying an Addressable

Referenced by DarkTonic.PoolBoss.PoolMiniBoss.RemoveItems().

static string DarkTonic.PoolBoss.PoolBoss.GetPrefabName ( Transform  trans)
static

This will return the name of the game object's prefab without "(Clone X)" in the name. It is used internally by PoolBoss for a lot of things.

Parameters
transThe Transform of the game object
Returns
string

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.GetPrefabName().

static string DarkTonic.PoolBoss.PoolBoss.GetPrefabName ( GameObject  go)
static

This will return the name of the game object's prefab without "(Clone X)" in the name. It is used internally by PoolBoss for a lot of things.

Parameters
goThe Game Object of the game object
Returns
string
static string DarkTonic.PoolBoss.PoolBoss.GetPrefabShortName ( string  prefabName)
static

This will return the name of the game object's prefab without "(Clone X)" in the name.

Parameters
prefabNameThe name of the game object
Returns
string
static void DarkTonic.PoolBoss.PoolBoss.Initialize ( )
static

Called automatically by default. If you uncheck "Create Items On Start", you will need to call this after your client has joined the room so they have Pool Boss.

static bool DarkTonic.PoolBoss.PoolBoss.IsSpawned ( GameObject  go)
static

Returns whether a specified Game Object is spawned. If not, the it's available to spawn.

Parameters
goThe game object in question
Returns
bool
static Transform DarkTonic.PoolBoss.PoolBoss.NextPoolItemToSpawn ( Transform  trans)
static

Call this get the next available item to spawn for a pool item.

Parameters
transTransform you want to get the next item to spawn for.
Returns
Transform

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.NextPoolItemToSpawn().

static Transform DarkTonic.PoolBoss.PoolBoss.NextPoolItemToSpawn ( string  itemName)
static

Call this get the next available item to spawn for a pool item.

Parameters
itemNameName of item you want to get the next item to spawn for.
Returns
Transform
static PoolItemInstanceList DarkTonic.PoolBoss.PoolBoss.PoolItemInfoByName ( string  poolItemName)
static

Call this method get info on a Pool Boss item (number of spawned and despawned copies, allow instantiate more, log etc).

Parameters
poolItemNameThe name of the prefab you're asking about.
Returns
The list of pool items.
static int DarkTonic.PoolBoss.PoolBoss.PrefabDespawnedCount ( Transform  transPrefab)
static

This will tell you how many available clones of a prefab are despawned and ready to spawn. A value of -1 indicates an error

Parameters
transPrefabThe transform component of the prefab you want the despawned count of.
Returns
Integer value.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.PrefabDespawnedCount().

static bool DarkTonic.PoolBoss.PoolBoss.PrefabIsInPool ( Transform  trans)
static

Call this method determine if the item (Transform) you pass in is set up in Pool Boss.

Parameters
transTransform you want to know is in the Pool or not.
Returns
Boolean value.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.PrefabIsInPool().

static bool DarkTonic.PoolBoss.PoolBoss.PrefabIsInPool ( string  transName)
static

Call this method determine if the item name you pass in is set up in Pool Boss.

Parameters
transNameItem name you want to know is in the Pool or not.
Returns
Boolean value.
static int DarkTonic.PoolBoss.PoolBoss.PrefabSpawnedCount ( Transform  transPrefab)
static

This will tell you how many clones of a prefab are already spawned out of Pool Boss. A value of -1 indicates an error

Parameters
transPrefabThe transform component of the prefab you want the spawned count of.
Returns
Integer value.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.PrefabSpawnedCount().

static void DarkTonic.PoolBoss.PoolBoss.RegisterPotentialInScenePoolable ( PoolableInfo  poolable)
static

This is called by PoolableInfo components on objects that begin in the Scene, so Pool Boss will know about them and put them in the "Spawned" list.

Parameters
poolable
static Transform DarkTonic.PoolBoss.PoolBoss.Spawn ( Transform  transToSpawn,
Vector3  position,
Quaternion  rotation,
Transform  parentTransform 
)
static

Call this method to spawn a prefab using Pool Boss. All the Spawners and Killable use this method.

Parameters
transToSpawnTransform to spawn
positionThe position to spawn it at
rotationThe rotation to use
parentTransformThe parent Transform to use
Returns
The Transform of the spawned object. It can be null if spawning failed from limits you have set.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.Spawn().

static Transform DarkTonic.PoolBoss.PoolBoss.Spawn ( string  itemName,
Vector3  position,
Quaternion  rotation,
Transform  parentTransform 
)
static

Call this method to spawn a prefab using Pool Boss. All the Spawners and Killable use this method.

Parameters
itemNameName of the transform to spawn
positionThe position to spawn it at
rotationThe rotation to use
parentTransformThe parent Transform to use
Returns
The Transform of the spawned object. It can be null if spawning failed from limits you have set.
static Transform DarkTonic.PoolBoss.PoolBoss.SpawnInPool ( string  itemName,
Vector3  position,
Quaternion  rotation 
)
static

Call this method to spawn a prefab using Pool Boss, which will be a child of the Pool Boss prefab.

Parameters
itemNameName of Transform to spawn
positionThe position to spawn it at
rotationThe rotation to use
Returns
The Transform of the spawned object. It can be null if spawning failed from limits you have set.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.SpawnInPool().

static Transform DarkTonic.PoolBoss.PoolBoss.SpawnInPool ( Transform  transToSpawn,
Vector3  position,
Quaternion  rotation 
)
static

Call this method to spawn a prefab using Pool Boss, which will be a child of the Pool Boss prefab.

Parameters
transToSpawnTransform to spawn
positionThe position to spawn it at
rotationThe rotation to use
Returns
The Transform of the spawned object. It can be null if spawning failed from limits you have set.
static Transform DarkTonic.PoolBoss.PoolBoss.SpawnOutsidePool ( string  itemName,
Vector3  position,
Quaternion  rotation 
)
static

Call this method to spawn a prefab using Pool Boss, which will be spawned with no parent Transform (outside the pool)

Parameters
itemNameName of Transform to spawn
positionThe position to spawn it at
rotationThe rotation to use
Returns
The Transform of the spawned object. It can be null if spawning failed from limits you have set.

Referenced by DarkTonic.PoolBoss.PoolBossExtensions.SpawnOutsidePool().

static Transform DarkTonic.PoolBoss.PoolBoss.SpawnOutsidePool ( Transform  transToSpawn,
Vector3  position,
Quaternion  rotation 
)
static

Call this method to spawn a prefab using Pool Boss, which will be spawned with no parent Transform (outside the pool)

Parameters
transToSpawnTransform to spawn
positionThe position to spawn it at
rotationThe rotation to use
Returns
The Transform of the spawned object. It can be null if spawning failed from limits you have set.
static void DarkTonic.PoolBoss.PoolBoss.UnregisterNonStartInScenePoolable ( PoolableInfo  poolable)
static

This is called by PoolableInfo components that get spawned, so we know to remove them from the in scene objects list.

Parameters
poolable

Property Documentation

bool DarkTonic.PoolBoss.PoolBoss.IsReady
staticget

This property is set to true when all pool items are ready to spawn.

int DarkTonic.PoolBoss.PoolBoss.PrefabCount
staticget

This property will tell you how many different items are set up in Pool Boss.


The documentation for this class was generated from the following file: