Class SpawnerNode.SpawnerWorker<T>
The base class to spawn objects.
Inheritance
Inherited Members
Namespace: Holoride.ElasticSDK.Graph.Spawners
Assembly: Holoride.ElasticSDK.Runtime.dll
Syntax
protected abstract class SpawnerNode.SpawnerWorker<T> : SpawnerWorker, IPipelineWorker, IShiftParent where T : SpawnerNode
Type Parameters
Name | Description |
---|---|
T | The generating node type deriving from Spawner. |
Constructors
SpawnerWorker(T, bool)
Instantiates the worker.
Declaration
protected SpawnerWorker(T node, bool isUnconstrained)
Parameters
Type | Name | Description |
---|---|---|
T | node | A back reference to the node that created this worker. |
bool | isUnconstrained | Whether this spawner uses unconstrained extents. |
SpawnerWorker(T)
Instantiates the worker.
Declaration
protected SpawnerWorker(T node)
Parameters
Type | Name | Description |
---|---|---|
T | node | A back reference to the node that created this worker. |
Fields
Node
A reference to the node that generated this worker in order to access its serialized data.
Declaration
protected readonly T Node
Field Value
Type | Description |
---|---|
T |
Properties
ShiftParent
Gets or sets the GameObject that's parent to spawned GameObjects.
Declaration
public GameObject ShiftParent { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
DestroyCell(IEnumerable<GameObject>)
Destroys all objects within a cell by destroying them. Override this function to treat disappearing objects differently, e.g. to return them to an object pool.
Declaration
public override void DestroyCell(IEnumerable<GameObject> gameObjects)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<GameObject> | gameObjects | The game objects to destroy. |
Overrides
InitializeInstance(GameObject, SpawnCandidate, CancellationToken)
Perform early initialization of a spawned instance.
This allows configuration before the instances Awake/OnEnable/RetrievedFromPool is called.
Declaration
protected virtual UniTask InitializeInstance(GameObject instance, SpawnCandidate candidate, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GameObject | instance | The instance to initialize. |
SpawnCandidate | candidate | The spawn candidate the instance was created for. |
CancellationToken | cancellationToken | Token to cancel the async UniTask operation. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask |
InstantiateAndInject(GameObject, Vector3, Quaternion, SpawnCandidate, float, CancellationToken)
Utility method to create an instance from a prefab that gets filled with the dynamic port data from the node graph (if it requested any).
Declaration
protected UniTask<GameObject> InstantiateAndInject(GameObject prefab, Vector3 position, Quaternion rotation, SpawnCandidate candidate, float scale = 1, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The prefab to be instantiated. |
Vector3 | position | The position of the instantiated prefab. |
Quaternion | rotation | The rotation of the instantiated prefab. |
SpawnCandidate | candidate | The spawn candidate the instance was created for. |
float | scale | The optional scale of the prefab. |
CancellationToken | cancellationToken | Token to cancel the async UniTask operation. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask<T><GameObject> | The created instance. |