PooledObjectDefinitionBase
An abstract class in Root.Township, the global namespace.
Asset for a pooled object (usually a visual effect) with helpers to spawn it at transforms, hits or positions. Most helpers do nothing on a headless server.
- Listed in Global namespace: P
- Inherits or implements
ScriptableObject - Derived types
PooledObjectDefinition,RandomPooledObjectDefinition
Constructors
| Member | What it is |
|---|---|
protected PooledObjectDefinitionBase() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
1 private and internal field
| Member | What it is |
|---|---|
private Dictionary<Transform, PooledObject> lifetimePooledObjects | Objects spawned with SpawnAtParentedForLifeTime, one per parent, until ReleaseLifeTime is called. |
Methods
| Member | What it is |
|---|---|
PooledObject Get() | Takes an object from the pool at a position and rotation, or parented to a transform. |
PooledObject Get(Vector3 position) | Takes an object from the pool at a position and rotation, or parented to a transform. |
PooledObject Get(Transform parent) | Takes an object from the pool at a position and rotation, or parented to a transform. |
abstract PooledObject Get(Vector3 position, Quaternion rotation) | Takes an object from the pool at a position and rotation, or parented to a transform. |
abstract void InitializePool() | Subclass: sets up the pool. |
void ReleaseLifeTime(Transform parent) | Releases the object kept for a parent. |
void SpawnAlignedHit(ImpactHit hit) | Spawns at an impact point facing along the hit normal. Skipped on headless. |
void SpawnAt(Transform target) | Spawns at a transform (skipped on headless) or a position (always). |
void SpawnAt(Transform target, float scale) | Spawns at a transform (skipped on headless) or a position (always). |
void SpawnAt(Vector3 position) | Spawns at a transform (skipped on headless) or a position (always). |
void SpawnAt(Vector3 position, Quaternion rotation) | Spawns at a transform (skipped on headless) or a position (always). |
void SpawnAtEndOfFrame(Transform target) | Spawns at a transform on a delayed call. Skipped on headless. |
void SpawnAtParented(Transform target) | Spawns as a child of a transform. Skipped on headless. |
void SpawnAtParentedForLifeTime(Transform parent) | Spawns one object parented to a transform and keeps it until ReleaseLifeTime. Only one per parent. |
void SpawnAtProxy(TransformProxy target) | Spawns at a transform proxy's position and rotation. Skipped on headless. |
Used in
Members of other types that take, return or hold a PooledObjectDefinitionBase: