Component:DynamicField: Difference between revisions

From Resonite Wiki
Add template
move from `1 here
 
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
Dynamic Field is a component that allows marking of any [[Type:IField`1|IField]] as part of the [[Dynamic Variables]] System. The value inside of the specified [[Type:IField`1|IField]] can change and will be changed by the [[Dynamic Variables]] System. The variable name and the type of variable will determine how this will link to and be changed by the [[Dynamic Variables]] System. For more info on how Dynamic Variables work please check the [[Dynamic Variables]] page.
{{Infobox Component
{{Infobox Component
|Image=DynamicField`1Component.png
|Image=DynamicField`1Component.png
|Name=Dynamic Field`1
|Name=DynamicField<T>
}}
}}
The '''DynamicField<T>''' binds the [[field]] pointed to by <code>TargetField</code> to the [[dynamic variable]] referred to by <code>VariableName</code>. The field must be a [[value type]].


<!--T:2-->
<!--T:3-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|VariableName|String| {{Template:Variable Name Component}}
|VariableName|String|The name of the dynamic variable to be used
|TargetField|IField`1|TypeString1=IField<float>| The Field to link to the [[Dynamic Variables]] System
|TargetField|{{RootFieldType|RelayRef`1|[[Type:IField`1|IField`1]]&lt;T&gt;}}|TypeAdv1=true|The field that will be used as the dynamic variable's value.
|OverrideOnLink|Bool| {{Template:OverrideOnLink Field}}
|OverrideOnLink|Bool|If true, the value of the field will be written when this component is moved into a new space
}}
}}


<!--T:3-->
<!--T:4-->
== Usage ==
== Usage ==
This component works almost exactly like the [[Component:DynamicValueVariable|DynamicValueVariable]] component, except that the value used for the dynamic variable is sourced from a separate field. This field will be automatically updated with the value of the dynamic variable, and writing to the field will write to the dynamic variable. This can be used to directly bind fields of separate components as a dynamic variable without having to use a [[Component:DynamicValueVariableDriver|DynamicValueVariableDriver]] or similar setup.


<!--T:4-->
<!--T:5-->
== Examples ==
== Examples ==


<!--T:5-->
<!--T:6-->
== Related Components ==
== See Also ==
* [[Dynamic Variables]]
* [[Component:DynamicReference]], for the same functionality but with [[reference types]].
* [[Component:DynamicValueVariable]]
</translate>
</translate>
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|Dynamic Field`1]]
[[Category:Components{{#translation:}}|Dynamic Field`1]]
[[Category:Generic Components{{#translation:}}|Dynamic Field`1]]
[[Category:Components:Data:Dynamic{{#translation:}}|Dynamic Field`1]]
[[Category:Components:Data:Dynamic{{#translation:}}|Dynamic Field`1]]

Latest revision as of 14:23, 14 November 2024

Component image 
DynamicField<T> component as seen in the Scene Inspector

The DynamicField<T> binds the field pointed to by TargetField to the dynamic variable referred to by VariableName. The field must be a value type.

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.
VariableName String The name of the dynamic variable to be used
TargetField direct RelayRef`1<IField`1<T>> The field that will be used as the dynamic variable's value.
OverrideOnLink Bool If true, the value of the field will be written when this component is moved into a new space

Usage

This component works almost exactly like the DynamicValueVariable component, except that the value used for the dynamic variable is sourced from a separate field. This field will be automatically updated with the value of the dynamic variable, and writing to the field will write to the dynamic variable. This can be used to directly bind fields of separate components as a dynamic variable without having to use a DynamicValueVariableDriver or similar setup.

Examples

See Also