Component:RandomObjectSpawner: Difference between revisions

From Resonite Wiki
Automated: update SyncDelegates
add sync delegate desc
 
Line 1: Line 1:
<languages></languages>
<languages></languages>
<translate>
<translate>
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=RandomObjectSpawnerComponent.png
|Image=RandomObjectSpawnerComponent.png
|Name=RandomObjectSpawner
|Name=Random Object Spawner
}}
}}
The '''RandomObjectSpawner''' component selects a slot from the <code>Templates</code> list, and spawns it either at this component's parent (in the case of <code>Spawn()</code>), or at the point specified in an argument (in the case of <code>SpawnAtPoint()</code>)
The '''RandomObjectSpawner''' component selects a slot from the <code>Templates</code> list, and spawns it either at this component's parent (in the case of <code>Spawn()</code>), or at the point specified in an argument (in the case of <code>SpawnAtPoint()</code>)


== Usage ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Templates|{{RootFieldType|SyncList`1|[[#SpawnData|RandomObjectSpawner.SpawnData]]}}|TypeAdv0=true| List of slots to be selected from, when a Trigger is invoked
|Templates|{{RootFieldType|SyncList`1|[[#SpawnData|RandomObjectSpawner.SpawnData]]}}|TypeAdv0=true| List of slots to be selected from, when a Trigger is invoked
Line 17: Line 16:
{{Table ComponentTriggers
{{Table ComponentTriggers
|Spawn:[[Type:Action|Action]]|[[Type:Action|Action]]|false| Spawns a slot randomly selected from <code>Templates</code>, located at the origin of this component's parent slot.
|Spawn:[[Type:Action|Action]]|[[Type:Action|Action]]|false| Spawns a slot randomly selected from <code>Templates</code>, located at the origin of this component's parent slot.
|SpawnAtPoint:[[Type:Action`1|Action`1]]&lt;[[Type:Float3|Float3]]&gt;|[[Type:Action`1|Action`1]]&lt;[[Type:Float3|Float3]]&gt;|false|
|SpawnAtPoint:[[Type:Action`1|Action`1]]&lt;[[Type:Float3|Float3]]&gt;|[[Type:Action`1|Action`1]]&lt;[[Type:Float3|Float3]]&gt;|false| Spawns a slot randomly selected from <code>Templates</code>, located at the provided point.
}}
}}


Line 30: Line 29:
The <code>SpawnAtPoint()</code> trigger can be invoked by a component such as [[CharacterEventTrigger (Component)|Character Event Trigger]], which provides the required '''[[Type:Float3| Float3]]''' argument.
The <code>SpawnAtPoint()</code> trigger can be invoked by a component such as [[CharacterEventTrigger (Component)|Character Event Trigger]], which provides the required '''[[Type:Float3| Float3]]''' argument.


== Related Components ==
== See Also ==
</translate>
</translate>
[[Category:Components{{#translation:}}|Random Object Spawner]]
[[Category:Components{{#translation:}}|Random Object Spawner]]

Latest revision as of 21:45, 7 April 2025

Component image 
Random Object Spawner component as seen in the Scene Inspector

The RandomObjectSpawner component selects a slot from the Templates list, and spawns it either at this component's parent (in the case of Spawn()), or at the point specified in an argument (in the case of SpawnAtPoint())

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't.
Templates list of RandomObjectSpawner.SpawnData List of slots to be selected from, when a Trigger is invoked
SpawnSpace direct RootSpace The coordinate space in which the template item will be spawned.

Sync Delegates

Triggers
Method Name Method type and Arguments. Is the method hidden? Description
Spawn:Action Action X Spawns a slot randomly selected from Templates, located at the origin of this component's parent slot.
SpawnAtPoint:Action`1<Float3> Action`1<Float3> X Spawns a slot randomly selected from Templates, located at the provided point.

Behavior

When triggered by any event source that accepts an Action (for Spawn()), or Action<float3> (for SpawnAtPoint(), this component will spawn a random slot from Templates

Prior to Build 2020.11.8.605, this component would duplicate a random slot from Templates in-place, without changing its location.

Examples

The Spawn() trigger can be invoked by a component such as Button Action Trigger, when bound to a UIX Button or Legacy Button

The SpawnAtPoint() trigger can be invoked by a component such as Character Event Trigger, which provides the required Float3 argument.

See Also