Explain IComponent and how the casting works. Feel free to link Casting instead. |
m 989onan moved page Types:IComponent to Type:IComponent: Misspelled title: type not types |
(No difference)
|
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.