When Disposing Engine: TypeError: Cannot read properties of undefined (reading 'vertexBuffers')

Hi I dont have a reporo for this just yet but im wondering if anyone would have any clue why we are getting this error when disposing our Engine?

 TypeError: Cannot read properties of undefined (reading 'vertexBuffers')
    at Mesh._disposeInstanceSpecificData (instancedMesh.ts:791:47)
    at Mesh.dispose (mesh.ts:2481:14)
    at scene.ts:4059:55
    at Scene._disposeList (scene.ts:4158:13)
    at Scene.dispose (scene.ts:4059:14)
    at Engine.dispose (engine.ts:1878:28)
    at Engine.tsx:38:16
    at safelyCallDestroy (react-dom.development.js:22932:5)
    at commitHookEffectListUnmount (react-dom.development.js:23100:11)
    at commitPassiveUnmountInsideDeletedTreeOnFiber (react-dom.development.js:25098:11)

Is there something about instancedMesh that we should know about when disposing?

We are running BabylonJS 6.9.0

It seems there is a problem with one of the instance buffer you create for your mesh.

Try to look at the names of the key of mesh._userInstancedBuffersStorage.vertexBuffers for the source mesh (the mesh from which you create the instances) and compare them to mesh.instancedBuffers: you should have at least one name in the latter which is not in the former. If that is so, this is not normal, maybe you are misusing this buffer?

Okay I found the issue, I was setting instance buffers on a mesh that wasnt an instanced mesh. This caused the engine to crash when it disposed…

Dont do this :stuck_out_tongue: