Component:ValueMultiplexer: Difference between revisions

From Resonite Wiki
m GRRRR
rewords and typos
 
Line 4: Line 4:
}}
}}


The '''ValueMultiplexer''' component allow to curate a list of values and [[Drive|drive]] a target with one of them, much like a multiplexer.
The '''ValueMultiplexer''' component allows one to curate a list of values and [[Drive|drive]] a target with one of them, much like a multiplexer.


== Fields ==
== Fields ==
Line 18: Line 18:
The component behaves similar to a [[Component:ValueCopy|ValueCopy]] with the list entry indicated by <code>Index</code> as the value to output. Changes to <code>Index</code> or the list entries will affect <code>Target</code> whenever the drive is evaluated.
The component behaves similar to a [[Component:ValueCopy|ValueCopy]] with the list entry indicated by <code>Index</code> as the value to output. Changes to <code>Index</code> or the list entries will affect <code>Target</code> whenever the drive is evaluated.


In addition, the component implements the [[Type:IValue|IValue]] type. This allows the component to be [[ProtoFlux:Source|sourced]] by dragging out the component header with the ProtoFlux tip. This enables using the component like an array when sourcing the <code>Index</code> field as well. The source of this component will update instantly, as opposed to the drive being limited to once per frame.
In addition, the component implements the [[Type:IValue|IValue]] interface. This allows the component to be [[ProtoFlux:Source|sourced]] by dragging out the component header with the ProtoFlux tip. This allows one to use the component like an array when sourcing the <code>Index</code> field as well. The source of this component will update instantly, as opposed to the drive being limited to once per frame.


== Examples ==
== Examples ==

Latest revision as of 03:33, 10 December 2024

Component image 
Value Multiplexer component as seen in the Scene Inspector


The ValueMultiplexer component allows one to curate a list of values and drive a target with one of them, much like a multiplexer.

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.
Target field drive of T A field which is driven with the currently selected list value
Index Int 0-based index that determines which value of Values has been selected; values outside the range [0;length-1] are wrapped around internally.
Values direct SyncFieldList`1<T> A list of values which can also individually be driven or written to
AllowWriteBack Bool Setting this to true redirects writes from Target or from a Source representing the selected value to the currently indexed list entry.

Usage

The component behaves similar to a ValueCopy with the list entry indicated by Index as the value to output. Changes to Index or the list entries will affect Target whenever the drive is evaluated.

In addition, the component implements the IValue interface. This allows the component to be sourced by dragging out the component header with the ProtoFlux tip. This allows one to use the component like an array when sourcing the Index field as well. The source of this component will update instantly, as opposed to the drive being limited to once per frame.

Examples

See Also