stop method
Takes out what start put in — the scene renderer, the animation system, the model loader — and lets go of the renderer and the models: isStarted is false again.
Implementation
@override
Future<void> stop() async {
final engine = _engine;
final scene = _scene;
if (scene != null) {
engine?.rendering.removeSceneRenderer(scene);
scene.dispose();
}
final animations = _animations;
if (animations != null && engine?.isDisposed == false) {
engine?.world.removeSystem(animations);
}
final loader = _loader;
if (loader != null) {
engine?.assets.unregisterLoader(AssetType.model, loader);
}
_models?.listeners.remove(_modelReloaded);
_scene = null;
_animations = null;
_loader = null;
_models = null;
_renderer = null;
_engine = null;
}