I am trying to download and load an asset from our server on runtime, and it is done based on user requests so I can’t simply batch all the assets at once with AssetsManager. I am trying to load each asset one by one, and I have a separate Loading Screen (rendered with React, so it’s separate from the babylon canvas itself) that should display the progress in percentage as the asset loads.
However, I found out that the ImportMesh and ImportMeshAsync operations are both blocking, meaning any of my other functions (setTimeout, setInterval, or React setState) would not be executed while ImportMesh/ImportMeshAsync are being executed, and thus I have no way to simulate a smooth loading screen.
I have tried using the progress event callback, but that only gives progressive reports from around 0 to 50 to 100 (2 or 3 reports for the entire 5 seconds of loading). Is there a better way to smoothly display a loading percentage?
(Sorry for not providing a PG for this, but I don’t really know how to get React onto PG. I suppose an example could be as simple as trying to execute a setInterval operation while the asset is loading, but whatever callback passed to setInterval will not be called until LoadMesh/LoadMeshAsync finished downloading and importing the asset)