How to import meshes (GLB) for later use?

Hi all,

I’m attempting to build a preloading system for my game where I would like to load all my models (GLB) up front and display a loading bar while doing so.

The thing is, the only code I’ve been able to get working will load the mesh and immediately place it in my scene. For example:

await SceneLoader.ImportMeshAsync('', filepath, filename, scene);

What I want is to load my models before creating my scene, and then assemble my game world by creating clones of the originally loaded assets and positioning them according to my map data (I will have many repeat models, such as trees and rocks).

Is this possible? Or am I approaching this all wrong?

I’m new to Babylon.js, it’s amazing and I appreciate any and all advice shared.

Oh, we have the assets container that could be helpful here - Asset Containers | Babylon.js Documentation (babylonjs.com)

It is still attached to a specific scene, but you decide how and when to add assets to your scene.

2 Likes

Amazing! You’re a lifesaver, I’ll take a dive into this shortly and report back if it works for me :smiley:

1 Like

It works!! Thank you so much @RaananW :pray:

1 Like