Scene object management

Hi
I’m sure I’m just not understanding how to make best use of Babylon

I want to ‘pre-load’ meshes to an application ‘catalogue’
These will then need to be added/removed to/form my scene as User interacts with the application

Both the assetsManager & assetsContainer reference my scene – so meshes are automatically presented

??Is there another way of loading meshes - so that i can copy/clone them in to my scene when needed

Thanks

As far as I know AsssetContainers are the most convenient way do to anything that you need.
They provide also a simple way to clone or instance loaded meshes with instantiateModelsToScene method - AssetContainer | Babylon.js Documentation

4 Likes

There (nearly) always is :smiley:. You asked for the best (most integrated in a workflow method) and I believe the one given to you by @labris has been created just for that :wink:
With that said, you can import async and on demand any asset and through a function you can clone it, instance it and also dispose of it. Using instances, you would not dispose of your original mesh while it is still displayed in the scene in the form of instances, but you could make it !visible.

Thanks for your answers
So it looks like an assetsController will give me the flexibility I want

??Is there any reason why I should continue to use BOTH

The matter is that except ‘meshes’ one may have other types of assets to load, like binary files, images etc. In this case AssetManager has all needed things to help, like success callbacks, error handling etc.
Docs - Asset Manager | Babylon.js Documentation

1 Like