imported>Xekri Created page with "<languages></languages> <translate> <!--T:1--> {{stub}} {{Infobox Component |Image=ReferenceCast`2Component.png |Name=Reference Cast`2 }} <!--T:2--> == Fields == {{Table Comp..." |
Add info |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<translate> | <translate> | ||
<!--T:1--> | <!--T:1--> | ||
{{Infobox Component | {{Infobox Component | ||
|Image=ReferenceCast`2Component.png | |Image=ReferenceCast`2Component.png | ||
|Name=Reference Cast`2 | |Name=Reference Cast`2 | ||
}} | }} | ||
The '''ReferenceCast''' component can be used to try to take a type and change it to another type. This performs a C# cast which requires the types to be compatible for casting to make a result. | |||
<!--T:2--> | <!--T:2--> | ||
== Fields == | == Fields == | ||
{{Table ComponentFields | {{Table ComponentFields | ||
|Source| | |Source|'''I'''|TypeAdv0=true| The source type to convert | ||
|Target| | |Target|{{RootFieldType|RefDrive`1|O}}|TypeAdv1=true| The target field. Casts <code>Source</code> to this fields type, and then uses the result to drive this field. | ||
|WriteBack|Bool| | |WriteBack|Bool| whether to allow changes to the <code>Target</code> to update <code>Source</code> instead of discarding the change. | ||
}} | }} | ||
<!--T:3--> | <!--T:3--> | ||
== Usage == | == Usage == | ||
This is a way of changing a type without using [[ProtoFlux]]. Attaching this component can be difficult, so you should be familiar with [[Complex Types in Components]]. Keep in mind this does a C# Cast, which does not work with many different conversions. | |||
<!--T:4--> | <!--T:4--> | ||
Line 23: | Line 25: | ||
<!--T:5--> | <!--T:5--> | ||
== | == See Also == | ||
* [[ProtoFlux:Object Cast]] | |||
</translate> | </translate> | ||
[[Category:Generics{{#translation:}}]] | [[Category:Generics{{#translation:}}]] | ||
[[Category:Components{{#translation:}}|Reference Cast`2]] | [[Category:Components{{#translation:}}|Reference Cast`2]] | ||
[[Category:Generic Components{{#translation:}}|Reference Cast`2]] | |||
[[Category:Components:Transform:Drivers{{#translation:}}|Reference Cast`2]] | [[Category:Components:Transform:Drivers{{#translation:}}|Reference Cast`2]] |
Latest revision as of 02:15, 13 November 2024
Component image
The ReferenceCast component can be used to try to take a type and change it to another type. This performs a C# cast which requires the types to be compatible for casting to make a result.
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
|
I | The source type to convert |
Target
|
direct RefDrive`1<O> | The target field. Casts Source to this fields type, and then uses the result to drive this field.
|
WriteBack
|
Bool | whether to allow changes to the Target to update Source instead of discarding the change.
|
Usage
This is a way of changing a type without using ProtoFlux. Attaching this component can be difficult, so you should be familiar with Complex Types in Components. Keep in mind this does a C# Cast, which does not work with many different conversions.