Component:ValueCopy: Difference between revisions

From Resonite Wiki
imported>Art0007i
add small note about unnetworked valuecopy
 
add link
 
(4 intermediate revisions by 4 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=ValueCopy`1Component.png
|Image=ValueCopy`1Component.png
|Name=Value Copy`1
|Name=Value Copy
}}
}}
The '''ValueCopy''' component is used to copy one value to another place, driving the target with an write back option.


<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Source|IField`1|TypeString0=IField<float>| The source to copy the value from.
|Source|{{RootFieldType|RelayRef`1|[[Type:IField`1|IField`1]]&lt;T&gt;}}|TypeAdv0=true| The source to copy the value from.
|Target|IField`1|TypeString1=IField<float>| The target to copy the value to.
|Target|{{RootFieldType|FieldDrive`1|T}}|TypeAdv1=true| The target to copy the value to.
|WriteBack|Bool| Allow Target to write back to Source.
|WriteBack|Bool| Allow Target to write back to Source. See [[Drives#Write Backs|write backs]].
}}
}}


Line 32: Line 33:


<!--T:5-->
<!--T:5-->
== Related Components ==
== See Also ==
</translate>
</translate>
[[Category:ComponentStubs]]
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|Value Copy`1]]
[[Category:Components{{#translation:}}|Value Copy`1]]
[[Category:Generic Components{{#translation:}}|Value Copy`1]]
[[Category:Components:Transform:Drivers{{#translation:}}|Value Copy`1]]
[[Category:Components:Transform:Drivers{{#translation:}}|Value Copy`1]]

Latest revision as of 18:29, 17 February 2025

Component image 
File:ValueCopy`1Component.png
Value Copy component as seen in the Scene Inspector


The ValueCopy component is used to copy one value to another place, driving the target with an write back option.

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. Some components stop their functionality when this field is disabled, but some don't.
Source direct RelayRef`1<IField`1<T>> The source to copy the value from.
Target field drive of T The target to copy the value to.
WriteBack Bool Allow Target to write back to Source. See write backs.

Usage

Drives the target's value with the source's value. When using WriteBack, changes made to the Target are local while editing it. When the user is done setting it, it writes via a network sync to change the Source value. If the Source and Target are the same, the value will be completely local, and no network sync happens when changing the value. When using the ValueCopy to make fields local like this, joining users will have the host's value by default.

Examples

ValueCopy Example A ValueField<bool>'s Value is being self driven with a WriteBack - making the Value local, and still changeable. Changes to this value will be local.

ValueCopy Example A ValueField<int>'s Value is being driven to be 7 from another ValueField<int>'s Value. The one in pink is the one being driven.

ValueCopy Example The Target field is being edited to 4, to write back to the Source field.

See Also