Difference between revisions of "RandomObjectSpawner (Component)"

From Neos Wiki
Jump to navigation Jump to search
m
m
 
Line 7: Line 7:
 
}}
 
}}
 
== Intoduction ==
 
== Intoduction ==
The '''RandomObjectSpawner''' component selects a [[:Category:Types:RandomObjectSpawner.SpawnData| SpawnData]] from the <code>Templates</code> list, and spawns its slot 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 ==
 
== Usage ==
Line 15: Line 15:
 
}}
 
}}
 
{{Table ComponentFields
 
{{Table ComponentFields
|Templates|RandomObjectSpawner.SpawnData|TypeString0=List<SpawnData>| List of slots to be selected from, when a Trigger is invoked
+
|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.
 
|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.
 
|UseParentSpace|Bool| Template item will be spawned in the parent of the <code>LocalSpace</code> slot, unless <code>OverrideRootSpace</code> is set.
Line 21: Line 21:
 
}}
 
}}
 
== 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 choose a random [[:Category:Types:RandomObjectSpawner.SpawnData| SpawnData]] from <code>Templates</code> based on the provided weight, and spawn its Template slot.
+
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>
  
 
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 [[NeosButton (Component)| Neos 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 [[NeosButton (Component)| Neos Button]]

Latest revision as of 06:01, 9 November 2020


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


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

Triggers
Name Arguments Description
Spawn() None Spawns a slot randomly selected from Templates, located at the origin of this component's parent slot.
SpawnAtPoint() Float3 Spawns a slot randomly selected from Templates, located at the position specified in the Float3 argument
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 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 UseParentSpace is true, or OverrideRootSpace is not null.
UseParentSpace Bool Template item will be spawned in the parent of the LocalSpace slot, unless OverrideRootSpace is set.
OverrideRootSpace RootSpace Reference to a SpawnSpace element on another component, which overrides LocalSpace and UseParentSpace on this component.

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

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

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

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

Examples

Related Components