removeComponent method
Detaches component from this node.
Fires Component.onUnmount (when this node is in a live scene) and
Component.onDetach. Throws if component is not attached here.
Implementation
void removeComponent(Component component) {
if (!_components.contains(component)) {
throw Exception('Component is not attached to this node');
}
if (_renderScene != null) {
component.unmount();
}
component.detachFrom();
_components.remove(component);
if (component is MeshComponent) {
_meshComponents.remove(component);
markBoundsDirty();
} else if (component is InstancedMeshComponent) {
_instancedMeshComponents.remove(component);
}
}