Loading large .glb files. I want to download the data, but wait to parse the file into the scene

I have a game with 5 large (~12MB) .glb files. These are being loaded using AssetManager.addMeshTask. This works correctly.

After the file has been downloaded, Babylon parses them and the browser freezes. This isn’t unexpected for a large file, but the user only uses one of these at a time, and may not use more than one in a session.

Currently we’re loading all the files up front, but this is pretty slow. My solution is to load only the 1 required file up front, then start the game, then continue loading the other 4 files in the background. However, parsing the files causes the game to freeze. So I’d like to know if there’s a way to download the file data, but not parse the file into the Babylon scene, only doing that at a later time when the user chooses a new character.

Thanks for your help

you can still download the data and then use createObjectUrl to give it when you want to the asset loader

I’ve tried using SceneLoader.LoadAssetContainer because here it states that it “does not append them to the scene”. This doesn’t make a difference.

Ah so I can use fetch or something to download the data, then pass the result of createObjectUrl to the asset loader?

this is correct!

1 Like

Just to follow up on this for anyone else who might run into the same issue:

I fetch the .glb file, store the object URL for the blob, then when the player wants to access that mesh later on I use SceneLoader.ImportMesh, making sure to pass ".glb" as the pluginExtension.