Component:ReferenceCast

From Resonite Wiki
Revision as of 02:15, 13 November 2024 by 989onan (talk | contribs) (Add info)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Component image 
File:ReferenceCast`2Component.png
Reference Cast`2 component as seen in the Scene Inspector

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

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.

Examples

See Also