|
Infohazard.Core 1.4.2
Infohazard Core Utility Library
|
Attach this component to a prefab to enable it to use the pooling system. More...
Public Member Functions | |
| void | DespawnSelf () |
| Despawn this instance and return it to the PoolManager. More... | |
Static Public Member Functions | |
| static Spawnable | Spawn (Spawnable prefab, Vector3? position=null, Quaternion? rotation=null, Transform parent=null, bool inWorldSpace=false, ulong persistedInstanceID=0, Scene? scene=null) |
| Spawn a new pooled instance with the given properties. More... | |
| static Spawnable | Spawn (Spawnable prefab, in SpawnParams spawnParams=default) |
| Spawn a new pooled instance with the given properties. More... | |
| static void | Despawn (Spawnable instance, float inSeconds=0.0f) |
| Despawn a pooled instance, optionally after some time has passed. More... | |
| static GameObject | Spawn (GameObject prefab, Vector3? position=null, Quaternion? rotation=null, Transform parent=null, bool inWorldSpace=false, ulong persistedInstanceID=0, Scene? scene=null) |
| Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script. More... | |
| static GameObject | Spawn (GameObject prefab, in SpawnParams spawnParams=default) |
| Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script. More... | |
| static void | Despawn (GameObject instance, float inSeconds=0.0f) |
| Despawn an instance, optionally after some time has passed, using the pooling system if the prefab has a Spawnable script. More... | |
| static T | Spawn< T > (T prefab, Vector3? position=null, Quaternion? rotation=null, Transform parent=null, bool inWorldSpace=false, ulong persistedInstanceID=0, Scene? scene=null) |
| Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script. More... | |
| static T | Spawn< T > (T prefab, in SpawnParams spawnParams=default) |
| Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script. More... | |
Properties | |
| bool | Pooled [get] |
| Whether this object should be pooled. More... | |
| bool | IsSpawned [get, private set] |
| Whether or not this object is an active, spawned instance. More... | |
| bool | IsDespawned [get, private set] |
| Whether or not this object is currently an inactive instance. More... | |
| IPoolHandler | PoolHandler [get, set] |
| IPoolHandler which was used to spawn the object. More... | |
Events | |
| Action< Spawnable > | Spawned |
| Invoked when the Spawnable is spawned. More... | |
| Action< Spawnable > | Despawned |
| Invoke when the Spawnable is despawned. More... | |
| Action< Spawnable > | Destroyed |
| Invoked when the Spawnable is destroyed (not just despawned). More... | |
Attach this component to a prefab to enable it to use the pooling system.
The static methods in this class are also the main way to spawn objects in a way that's compatible with the pooling system. When a Spawnable object is spawned, it will broadcast the OnSpawned message to its children. When it is despawned, it will broadcast the OnDespawned method.
|
static |
Despawn an instance, optionally after some time has passed, using the pooling system if the prefab has a Spawnable script.
| instance | The instance to despawn. |
| inSeconds | The time to wait before despawning. If zero, despawn is synchronous. |
|
static |
Despawn a pooled instance, optionally after some time has passed.
| instance | The instance to despawn. |
| inSeconds | The time to wait before despawning. If zero, despawn is synchronous. |
| void Infohazard.Core.Spawnable.DespawnSelf | ( | ) |
Despawn this instance and return it to the PoolManager.
|
static |
Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script.
| prefab | The prefab to spawn. |
| spawnParams | Spawn properties. |
|
static |
Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script.
| prefab | The prefab to spawn. |
| position | The position to spawn at. |
| rotation | The rotation to spawn at. |
| parent | The parent to spawn under. |
| inWorldSpace | If true, position/rotation are global, else they are local to parent. |
| persistedInstanceID | Existing persisted instance ID to assign. |
| scene | The scene to spawn in. |
|
static |
Spawn a new pooled instance with the given properties.
| prefab | The prefab to spawn. |
| spawnParams | Spawn properties. |
|
static |
Spawn a new pooled instance with the given properties.
| prefab | The prefab to spawn. |
| position | The position to spawn at. |
| rotation | The rotation to spawn at. |
| parent | The parent to spawn under. |
| inWorldSpace | If true, position/rotation are global, else they are local to parent. |
| persistedInstanceID | Existing persisted instance ID to assign. |
| scene | The scene to spawn in. |
|
static |
Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script.
| prefab | The prefab to spawn. |
| spawnParams | Spawn properties. |
| T | : | Component |
|
static |
Spawn a new instance with the given properties, using the pooling system if the prefab has a Spawnable script.
| prefab | The prefab to spawn. |
| position | The position to spawn at. |
| rotation | The rotation to spawn at. |
| parent | The parent to spawn under. |
| inWorldSpace | If true, position/rotation are global, else they are local to parent. |
| persistedInstanceID | Existing persisted instance ID to assign. |
| scene | The scene to spawn in. |
| T | : | Component |
|
getprivate set |
Whether or not this object is currently an inactive instance.
|
getprivate set |
Whether or not this object is an active, spawned instance.
|
get |
Whether this object should be pooled.
|
getsetpackage |
IPoolHandler which was used to spawn the object.
| Action<Spawnable> Infohazard.Core.Spawnable.Destroyed |
Invoked when the Spawnable is destroyed (not just despawned).