Uncaught TypeError: Cannot set properties of undefined (setting '_isDirty')

Uncaught TypeError: Cannot set properties of undefined (setting ‘_isDirty’)
at TransformNode.computeWorldMatrix (transformNode.js:943:1)
at Scene._evaluateActiveMeshes (scene.js:3280:1)
at Scene._renderForCamera (scene.js:3463:1)
at Scene._processSubCameras (scene.js:3552:1)
at Scene.render (scene.js:3822:1)
at babylon.component.ts:407:42
at Engine._renderFrame (engine.js:910:1)
at Engine._renderLoop (engine.js:925:1)
at timer (zone.js:3155:1)
at push.23484._ZoneDelegate.invokeTask (zone.js:443:1)

I believe we need more information about your issue.
What is possible to say at the moment is that you are trying to set propeties of undefined variable.

5 Likes

Getting this error sometimes for scene.render()

And it is hanging the whole UI

Can you repro in the playground, I do not see how this can happen ?

Can it happen if we have multiple meshes with same name ?

Again, we’d need a repro to understand what’s going on

The issue was due to corrupted valued in Mesh .rotation

1 Like

In JavaScript, the majority of elements are objects, with the notable exceptions of null and undefined. When attempting to access an undefined variable, it invariably returns ‘undefined,’ and you cannot retrieve or modify any properties of an undefined object. This scenario triggers the “Uncaught TypeError: cannot set property of undefined.” To mitigate this issue, it’s crucial to ensure variable initialization, particularly in situations where initialization is missing. Furthermore, adhering to best practices, you should verify the values of variables for null or undefined before utilizing them. If you only need to ascertain whether a value exists, you can use an ‘if’ statement, and if you’re uncertain about a variable’s existence, use the ‘typeof’ operator to check it, like so:

if (value) {
  // Perform an action
}

if (typeof some_variable !== "undefined" && some_variable !== null) {
  // Manage the value
}
1 Like