Component:ReferenceCopy: Difference between revisions

From Resonite Wiki
m ProbablePrime moved page ReferenceCopy (Component) to Component:ReferenceCopy: Creating component Namespace
Add info like valuecopt
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=ReferenceCopy`1Component.png
|Image=ReferenceCopy`1Component.png
|Name=Reference Copy`1
|Name=Reference Copy`1
}}
}}
The '''ReferenceCopy''' component is used to copy one reference to another place, driving the target with an write back option.


<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Source|SyncRef`1|TypeString0=SyncRef<IWorldElement>|
|Source|{{RootFieldType|RelayRef`1|[[Type:SyncRef`1|SyncRef`1]]&lt;T&gt;}}|TypeAdv0=true| The source to copy the Reference from
|Target|SyncRef`1|TypeString1=SyncRef<IWorldElement>|
|Target|{{RootFieldType|RefDrive`1|T}}|TypeAdv1=true| The target to drive to the value of <code>Source</code>
|WriteBack|Bool|
|WriteBack|Bool| whether to allow changes done to <code>Target</code> to change <code>Source</code>.
}}
}}


<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
Drives the target's reference with the source's reference. 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 reference. If the Source and Target are the same, the reference will be completely local, and no network sync happens when changing the reference. When using the ReferenceCopy to make fields local like this, joining users will have the host's reference by default.


<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
[[File:ReferenceCopyExample1.png | 512px | ReferenceCopy Example]]
A ReferenceField<slot>'s Reference is being self driven with a WriteBack - making the Reference local, and still changeable. Changes to this reference will be local.
[[File:ReferenceCopyExample2.png | 512px | ReferenceCopy Example]]
A ReferenceField<slot>'s Reference is being driven to be "hello" from another ReferenceField<slot>'s Reference. The one in pink is the one being driven.


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

Latest revision as of 00:46, 13 November 2024

Component image 
Reference Copy`1 component as seen in the Scene Inspector

The ReferenceCopy component is used to copy one reference 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.
Source direct RelayRef`1<SyncRef`1<T>> The source to copy the Reference from
Target direct RefDrive`1<T> The target to drive to the value of Source
WriteBack Bool whether to allow changes done to Target to change Source.

Usage

Drives the target's reference with the source's reference. 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 reference. If the Source and Target are the same, the reference will be completely local, and no network sync happens when changing the reference. When using the ReferenceCopy to make fields local like this, joining users will have the host's reference by default.

Examples

ReferenceCopy Example A ReferenceField<slot>'s Reference is being self driven with a WriteBack - making the Reference local, and still changeable. Changes to this reference will be local.

ReferenceCopy Example A ReferenceField<slot>'s Reference is being driven to be "hello" from another ReferenceField<slot>'s Reference. The one in pink is the one being driven.


See Also