I am using external javascript to listen for loadingFinished, loadingFinished seems to fire before the actual glb file is loaded when we have a white/blank screen in the Needle side of the build still. Is this a bug?
https://engine.needle.tools/docs/scripting.html#accessing-components-from-external-javascript
Original Post on Discord
by user 103054507105067008
Changed the channel name: White screen/glb files still loading after external javascript calls for loadingFinished fire
by user 103054507105067008
What do you mean by white screen? It is called when the first setup of the scene has been done
Will dm a link
by user 103054507105067008
by user 103054507105067008

by user 103054507105067008
Continue here from pm:
Maybe we need another callback for right after the first render (or before). You could add it via a custom component i think that dispatches an event on the engine element (this.context.domElement.dispatchEvent(new CustomEvent(“first-render”,…)))
See Finished Loading is around a few frames where the screen is white from the loading before content shows (this is the css white background that shows after an initial Loading bar that Needle shows by default)
by user 103054507105067008
Frame 10 is the event and 11 is the first render? That would line up with what i would expect
It actually shows finished loading at frame 9 and 10 of the gif but the gif framerate isn’t in sync with Chrome itself here as I recorded the gif at 12 fps
by user 103054507105067008
Such a callback might help with my recursive instantiation error, and also with the issue in engine_networking_files_default_components where trying to restore the code to add components to newly created objects locks up the engine.
by user 563549194137239552
I can confirm I just used a method with Start() to tell the html side that Needle finished loading which works great currently but an external javascript method would be ace
by user 103054507105067008
@Marcel_Wiessler1
can we subscribe to the loader event for ‘create scene’ to check when the ‘scene’ has loaded. something must fire then to display the object. so when that object is first displayed can we tie some listener into that?
by user 103054507105067008
Isnt that what you get with this approach here?
At the moment I am using a function in Start() but I am being told that the start function fires as the loader gets to ‘create scene’ after some diagnosis, as I was using a function in Start() to show a loading screen, the loading screen hides too early before create scene has finished
by user 103054507105067008
So our web dev is asking me if there is anything else I can add to listen for when ‘create scene’ has finished
by user 103054507105067008
What about onBeforeRender / onAfterRender? And then disable the component to call only once
Is that in the docs? I’ll read up on how to use that and try
by user 103054507105067008
The search on docs never works if I type things like onBeforeRender 
by user 103054507105067008