I think this is a bug.
what i am attempting to do is use the scene.onNewMeshAddedObservable to track when new meshes are added.
I want to evaluate new meshes and set them up for some application wide animations.
what I found tho, is that there’s a timing issue.
when a mesh is created using MeshBuilder, it immediately triggers the scene.onNewMeshAddedObservable.
this means that setting properties after creating it, such as position or material, or what have you, is missed. This makes sense though, and I don’t consider this the issue. But I wanted to get the extra info for my analysis. My first attempt to fix this involved using a setTimeout with a 50 ms wait, and that works so far, but feels…like it could run into potential bugs.
so I thought maybe I could tie in to the Mesh.onReady function. that apparently never fires. bug?
then i thought I could use the Mesh.onBeforeRenderObservable with addOnce. my thinking is whatever settings you are doing, probably are done by the time Render is reached.
and this blows up with an exception. so it seems the scene newMeshAdded observable is firing while the object is still being fully created, and the observables are not available to be set. this seems like a bug to me.
demo pg. first load shows the onReady not firing, set showBreak to true to see the observable break