SceneLoader.ImportMeshAsync to an AssetContainer or similar?


I would like to preload several different scenes without actually going to render them. I would like to have them preloaded so I can switch from Scenes without having to download the binary data.

I addition, I am interested to modify dynamically those scenes, like adding some meshes of other Scenes etc.

The process I would ideally would like to have is to preload several scenes inside for example an Asset Container. Then modify the AssetContainers and add for example a light or a predefined mesh. Then keep a copy of that AssetContainer , and when I want to be displayed , clone it and assign it as the Scene of the Engine instance.

To my understanding SceneLoader.ImportMeshAsync has as output Scene and not AbstractScene. So I cannot use AssetContainer as output type. I would like if there is a way to achieve what I mentioned before.


You can use LoadAssetContainer or LoadAssetContainerAsync maybe? BlendWebMix | Babylon.js Playground (


Some comments,

  1. to my understanding the constructor of HemisphericLight receives a Scene as parameter not an AssetContainer, it seems to work, but it does not respect the signature. Same for the constructor of FreeCamera .

  2. The asset container can be potentially modified inside the scene? I wonder if it is possible to clone the Asset container or do something equivalent ?

  1. Hmmm the intended way of using AssetContainer is to instantiate the objects into a scene and then adding them to the container, not instantiating directly to the container
  2. Well you have the add and remove methods, but it would be better to have a playground to see exactly what you intend to do…