Component:RandomObjectSpawner: Difference between revisions

From Resonite Wiki
m change resonite button to legacy button, type not types
update sync delegate argument names
 
(6 intermediate revisions by 3 users not shown)
Line 10: Line 10:


== Usage ==
== Usage ==
{{Table ComponentFields
|Templates|{{RootFieldType|SyncList`1|[[#SpawnData|SpawnData]]}}|TypeAdv0=true| List of slots to be selected from, when a Trigger is invoked
|SpawnSpace|{{RootFieldType|RootSpace}}|TypeAdv1=true| The coordinate space in which the template item will be spawned.
}}
== Sync Delegates ==
{{Table ComponentTriggers
{{Table ComponentTriggers
|Spawn()|''None''| Spawns a slot randomly selected from <code>Templates</code>, located at the origin of this component's parent slot.
|Spawn()|[[Type:Action`1|Action]]| Spawns a slot randomly selected from <code>Templates</code>, located at the origin of this component's parent slot.
|SpawnAtPoint()|'''[[Types:Float3|Float3]]'''| Spawns a slot randomly selected from <code>Templates</code>, located at the position specified in the <code>Float3</code> argument  
|SpawnAtPoint()|[[Type:Action`1|Action`1]]&lt;point: [[Types:Float3|Float3]]&gt;| Spawns a slot randomly selected from <code>Templates</code>, located at the position specified in the <code>Float3</code> argument  
}}
{{Table ComponentFields
|Templates|RandomObjectSpawner.SpawnData|TypeString0=SpawnData| List of slots to be selected from, when a Trigger is invoked
|LocalSpace|Slot| Slot where the selected template item will be spawned, unless <code>UseParentSpace</code> is true, or <code>OverrideRootSpace</code> is not null.
|UseParentSpace|Bool| Template item will be spawned in the parent of the <code>LocalSpace</code> slot, unless <code>OverrideRootSpace</code> is set.
|OverrideRootSpace|RootSpace| Reference to a [[Type:RootSpace|SpawnSpace]] element on another component, which overrides <code>LocalSpace</code> and <code>UseParentSpace</code> on this component.
}}
}}
== Behavior ==
== Behavior ==
When triggered by any event source that accepts an Action (for <code>Spawn()</code>), or Action<float3> (for <code>SpawnAtPoint()</code>, this component will spawn a random slot from <code>Templates</code>
When triggered by any event source that accepts an Action (for <code>Spawn()</code>), or Action<float3> (for <code>SpawnAtPoint()</code>, this component will spawn a random slot from <code>Templates</code>


Prior to [https://discordapp.com/channels/402159838827905024/469131434628612116/774938408870346772 Build 2020.11.8.605], this component would duplicate a random slot from <code>Templates</code> in-place, without changing its location.
== Examples ==
The <code>Spawn()</code> trigger can be invoked by a component such as [[ButtonActionTrigger (Component)| Button Action Trigger]], when bound to a [[Button (Component)|UIX Button]] or [[LegacyButton (Component)| Legacy Button]]
The <code>Spawn()</code> trigger can be invoked by a component such as [[ButtonActionTrigger (Component)| Button Action Trigger]], when bound to a [[Button (Component)|UIX Button]] or [[LegacyButton (Component)| Legacy Button]]


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.


Prior to [https://discordapp.com/channels/402159838827905024/469131434628612116/774938408870346772 Build 2020.11.8.605], this component would duplicate a random slot from <code>Templates</code> in-place, without changing its location.
== Examples ==
== Related Components ==
== Related Components ==
</translate>
</translate>
[[Category:Components{{#translation:}}|RandomObjectSpawner (Component){{#translation:}}]]
[[Category:Components{{#translation:}}|Random Object Spawner]]
[[Category:Components:Transform{{#translation:}}|RandomObjectSpawner (Component){{#translation:}}]]
[[Category:Components:Transform{{#translation:}}|Random Object Spawner]]
[[Category:Components With Nested Types{{#translation:}}|Random Object Spawner]]
[[Category:Triggers]]
[[Category:Triggers]]

Latest revision as of 19:38, 13 November 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
RandomObjectSpawner component as seen in the Scene Inspector

Intoduction

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())

Usage

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.
Templates list of 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. Description
Spawn() Action Spawns a slot randomly selected from Templates, located at the origin of this component's parent slot.
SpawnAtPoint() Action`1<point: Float3> Spawns a slot randomly selected from Templates, located at the position specified in the Float3 argument

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.

Related Components