addComponent method
Attaches component to this node.
The component must not already be attached to a node. This fires its Component.onAttach hook, and, if this node is already part of a live scene, its Component.onMount and Component.onLoad hooks.
Implementation
void addComponent(Component component) {
if (component.isAttached) {
throw Exception('Component is already attached to a node');
}
_components.add(component);
if (component is MeshComponent) {
_meshComponents.add(component);
markBoundsDirty();
} else if (component is InstancedMeshComponent) {
_instancedMeshComponents.add(component);
}
component.attachTo(this);
if (_renderScene != null) {
component.mount();
}
}