I would like to be able to identify when the object is already fully loaded in the engine
const box = new Entity()
box.getComponent(Transform).position.set(3, 1, 3)
var model=new GLTFShape()
box.addComponent(model)
engine.addEntity(box)
I mean something like this:
model.OnLoaded(()=>{/*The model load in Cache*/})
or
await engine.addEntity(box)
or
engine.addEntity(box,()=>{/*charging is complete*/})
I can't find a way to do this
any suggestions other than waiting without knowing what happens?
Unfortunately, as it stands now, there is no real concrete way to know when an asset is loaded. This feature (onLoading, onLoadComplete, ect) may be included in a future update. I believe it's on the roadmap. In the meantime, you may want to put a delay of some kind with either a setInterval or otherwise and set it to a few seconds, and then call whatever code you want.
There are workarounds, but they are crazy and I wouldn't recommend it, for your own sanity sake.