Type:IComponent: Difference between revisions

From Resonite Wiki
imported>ProbablePrime
m ProbablePrime moved page Category:Types:IComponent to Types:IComponent
 
Explain IComponent and how the casting works. Feel free to link Casting instead.
Line 1: Line 1:
{| class="wikitable"
IComponent is a component reference interface. Since it is an interface, it only allows interacting with the component in ways that all components can be interacted with. As such, this type can store any [[Component]] reference, no matter what kind of component it is.
|-
 
| Color
This type can be casted into a specific component, and the cast will give this type as the casted component type, provided the component stored in this data type is actually that component. For example, you can't cast the contents of an IComponent reference storing an [[ObjectRoot (Component)|ObjectRoot]] into a [[CopyGlobalTransform (Component)|CopyGlobalTransform]] or it will give null, to name one of many.
| Type
[[Category:Type]]
|-
| style="background-color:{{IComponent-color}}" |
| IComponent
|}
IComponent is a component reference.  
[[Category:Types]]

Revision as of 18:01, 16 January 2024

IComponent is a component reference interface. Since it is an interface, it only allows interacting with the component in ways that all components can be interacted with. As such, this type can store any Component reference, no matter what kind of component it is.

This type can be casted into a specific component, and the cast will give this type as the casted component type, provided the component stored in this data type is actually that component. For example, you can't cast the contents of an IComponent reference storing an ObjectRoot into a CopyGlobalTransform or it will give null, to name one of many.