Component:ValueMultiDriver
More actions

The ValueMultiDriver`1 component allows you to drive multiple fields from a single value. Whenever its Value changes, it writes that value to every field listed in Drives. This replaces setting up one driver per field when several fields should always hold the same value.
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. |
Value
|
T | Value of the specified type, which will be driven to all fields listed in Drives.
|
Drives
|
list of FieldDrive`1<T> | A list of fields to be driven by this component. Each entry is a drive that points at one field of the same type T.
|
Usage
Attach the component to a slot and choose the type T, which can be any of the engine's primitive types such as Bool, Float, Float3 or ColorX. Add one entry to Drives for each field you want to control, then link each entry to its target field. All targets have to be of type T.
Behavior
Each time the component updates after a change, it goes through Drives and writes Value into the target of every entry whose link is valid. Entries with no target, or whose link is not valid, are skipped, and the others are still driven.
Because the targets are driven, they cannot be edited by hand while the link is active, and the value in each of them always follows Value. To change all the targets, change Value, for example by driving it from another component or from ProtoFlux.
Examples
A ValueMultiDriver`1 with T set to Bool can drive the Active field of several slots from one checkbox or toggle, so that a whole set of slots is shown or hidden together.
See Also
- Component:ReferenceMultiDriver, the same idea for references instead of values
- Component:ValueDriver
- Component:ValueCopy
- Component:ValueMultiplexer