I want to try to create a resource manager in threejs. I consulted the documentation and found AssetsManager, but this resource manager is only responsible for loading resources. When loading a model file, I don’t want it to be added to the scene immediately. Also, how can I use the full URL to load the resource?
LoadAssetContainerAsync
See API here - Babylon.js docs
There are methods like addToScene()
, addAllToScene()
as well as removing functions.
The first argument in LoadAssetContainerAsync is the source
where you put the full URL.
I checked the API but it lacks linkage with AssetManager. I need onprogress and onFinish callbacks.
Here is onProgress
option - Babylon.js docs
Since LoadAssetContainerAsync is a Promise, one may check it’s fulfillment instead of old onFinish callback.
What I mean is onFinish after all resources are loaded. I checked the documentation and it seems there is no such thing. Maybe I can use Promise.all to achieve it?
This is the common way which seems reasonable
1 Like