Hi! Please be kindly, but i can’t understand onReady mechanic.
It very important and i think it usefull in 9 from 10 projects.
It is 3d question about that, and i’m sorry, but i need clear understand this mystery )
Jedi Masters, please, explain that
In total we have or not anything ready event?
I need create and invoke this event manually, based on recurse setTimeout or setInterval and ignore onReady callback from documentation? Im sure, it very bad way witch many reasons.
Here you go:
onReady | Babylon.js Playground
a sphere is ready for render right after it is creating. adding an onReady callback right after will do no good, as it was already called. It is like adding a click callback after the user already clicked - it will sadly not be triggered.
Thank you for example!
But… how useful from onReady callBack in this case? How we can use this?
In RxJS we can use ReplaySubject for send all passed events for all new subscribers. Perhaps in futher we need similar like that?
I have problem often with use MeshButton3D or HolographicButton or other Conrol3D from GUI.
That elements can get their meshes not immideatly, but as example Spherical Panel can’t correctly build layout if mesh of Control3D is empty.
I have to wait, and checking mesh presents before do anything.
If there is an event callback / observable missing in the MeshButton3D, please create a playground with the expected behavior, and we will be happy to look into it.
I am not sure how this will help in this case. The observable will notify before you will be able to add an observer. I am not against an observable, but it is not the solution in this case.
There are a few solutions, some require changes to the framework itself. I think the simplest would be to use the scene’s
onNewMeshAddedObservable. In it, check if the mesh is ready, and if it is not, add the onReady callback. This way you have a generic solution for all meshes.
It is a good working idea!
and thank for you ready to help! onReady )))
about Controls3D i going to try make example, if i can reproduce situation of course