[SOLVED] Detecting engine model loads/unloads?

Hi there, currently I’m using simple variable to determine if model finished loading as:

var modelLoads = true
//Some code where external models  are loaded or unloaded etc
var modelLoads = false

I have to share it trough several script files and well, I feel like it’s not the best way to do it, any smarter/built-in solutions to this? Thanks

Hi @Newbie_Coder,

All assets have a loaded property which indicates if they are loaded or not:

asset.loaded;

You can also subscribe to the following event to get a callback at the exact time an asset will finish loading and it will be ready:

asset.ready ( () => {
   console.log('I am ready! Asset name: ' + asset.name);
});
1 Like

Hmm, still not quite getting result I was expecting, what about lag/freeze end after asset has been applied to the world? Thanks

That’s the materials compiling their shaders most likely.

1 Like

I think we can mark this as solved, thank you @Leonidas

1 Like