Importing assets from large babylon file on demand

No repro, just a question. Its late here and it might be a dumb question cos I’m fatigued.

I have (as example) a .babylon file with a cube, sphere and a torus. When scene is created, the sphere is imported in. Upon user demand, say, on button click, I want to import the cube/torus into the scene at specific coordinates. The usual methods of importmesh/assetmanager works when the number of assets in the .babylon file is low as the round trip from server fetch is pretty fast.

But when my .babylon file has many assets and the file size is larger, ie, approx 50mb, the server fetch is slow. In this case, I want to preload the .babylon file preferably as a var or easily referenced asset client-side. What are the usual methods that can allow me to do so ? Can I store the file in client-side indexdb ? or access it from cache ?

I guess you could convert the file in a blob URL so it stays local but it is far from ideal.

Another option is to use an assetContainer so you could intantiates models in the scene from it.

The most pragmatic one You load all of it in the scene and disable all the meshes then on demand clone from them :slight_smile:

1 Like

This is what I did right at the start of the project. As dev progressed, it made sense that users may not use all meshes so it made sense avoid bloating by importing meshes only on demand. Guess I just have to bit the bullet…

Thanks for the counsel, cheers ! :slight_smile: