|Index|Int|0-based index that determines which value of <code>Values</code> has been selected; values outside the range <code>[0;length-1]</code> are wrapped around internally.
|Index|Int|0-based index that determines which value of <code>Values</code> has been selected; values outside the range <code>[0;length-1]</code> are wrapped around internally.
|Values|{{RootFieldType|SyncFieldList`1|T}}|TypeAdv2=true|A list of values which can also individually be driven or written to
|Values|{{RootFieldType|SyncFieldList`1|T}}|TypeAdv2=true|A list of values which can also individually be driven or written to
|AllowWriteBack|Bool|Setting this to <code>true</code> redirects writes to <code>Target</code> or to a <code>Source</code> representing the selected value to the currently indexed list entry.
|AllowWriteBack|Bool|Setting this to <code>true</code> redirects writes from <code>Target</code> or from a <code>Source</code> representing the selected value to the currently indexed list entry.
}}
}}
Revision as of 17:04, 10 July 2024
Component image
Value Multiplexer`1 component as seen in the Scene Inspector
ValueMultiplexers allow to curate a list of values and drive a target with one of them.
They implement IValue which means that a reference to them can be used to create a Source node representing the currently indexed value. This enables using them like arrays when combined with a Source of the Index field.
Setting this to true redirects writes from Target or from a Source representing the selected value to the currently indexed list entry.
Behavior
The component behaves similar to a ValueCopy with the list entry indicated by Index as its Source.
Changes to Index or the list entries will affect Target whenever the drive is evaluated.
On the other hand the Source of this component updates instantly.
Examples
Array-like access from within ProtoFlux. Note the setting of AllowWriteBack and that you can only access a single value at a time!A demonstration of what happens when Index is outside the usual range. (wraps around)