Hi, not a big issue for me as I could get by by delaying the call to getWorldExtends()
but just happened to notice that if you call getWorldExtends()
inside the onNewMeshAddedObservable
callback.
At a quick glance the following seems to happen:
-
getWorldExtends()
callscomputeWorldMatrix()
for each mesh - After the compute, mesh calls its
_afterComputeWorldMatrix()
which checks forthis.hasThinInstances
-
hasThinInstances
tries to access the_thinInstanceDataStorage
that has not been initialised yet - The initialisation will happen quite early on in the constructor of a new mesh, but the
onNewMeshAddedObservable
is being called by the call to super (AbstractMesh) in the constructor which is the first thing that happens in new Mesh()
Where I noticed this I seemed to also get some error about accessing _LODLevels on undefined as I was loading the scene from a file, but didn’t dig deeper into that.
Sorry for the somewhat messy explanation
Playground repro:
https://playground.babylonjs.com/#6506MQ