Sceneless AssetContainer loading (for instantiateModelsToScene)

As the title says, being able to load a AssetContainer without a scene and only provide a scene when adding to a scene. For example:

let scene = new Scene(engine);
SceneLoader.loadAssetContainerAsync('', 'example.gltf').then(container => {
	container.instantiateModelsToScene(scene);

	//or

	container.addAllToScene(scene);

	//maybe use the last created scene as default?
});

The primary use case for this would be multi-scene projects that use a model across multiple scenes (e.g. my game). I’ve found loading the 6+ models in every new scene has a huge performance overhead for each scene creation (especially when the number of scenes gets to 10+).

I think this could be possible. Wanna try to send a PR?

I’m assuming we would work on it together?

I’ll be more than happy to provide guidance and review yes!

Sure, I’d love to contribute to the engine!

A couple questions:

  1. what does the scene pending data do (scene._addPendingData/scene._removePendingData)?
  2. what does SceneLoader._LoadData do?

this is used by the scene to check if everything is loaded and ready to go
In this case we can simply ignore it

2 Likes

I’ve been looking at how it all flows together:

SceneLoader.LoadAssetContainerSceneLoader._LoadData(ISceneLoaderPlugin).loadFileScene.prototype._loadFilefileTools.ts / LoadFilefileTools.ts / RequestFile

What does scene._activeRequests do?