destroyAssets method

  1. @override
Future destroyAssets()
override

Implementation

@override
Future destroyAssets() async {
  _logger.info("Destroying ${_assets.length} assets");
  for (final asset in _assets) {
    _logger.info("Destroying asset ${asset.getHandle()}");
    await scene.remove(asset);
    await hideBoundingBox(asset, destroy: true);

    for (final instance in (await asset.getInstances()).cast<FFIAsset>()) {
      await scene.remove(instance);
      await hideBoundingBox(instance, destroy: true);
    }
    await FilamentApp.instance!.destroyAsset(asset);
    _logger.info("Destroyed asset");
  }
  _assets.clear();
}