Today I tried upgrading my app from 4.1 to 4.2 and faced a crash. This is also reproducible with the latest preview, v5.0.0-alpha.15.
The error I get:
Uncaught TypeError: can't access property "meshes", _this.getScene() is null
Code level stack trace:
- Babylon.js/renderTargetTexture.ts at master · BabylonJS/Babylon.js · GitHub
- Babylon.js/abstractMesh.ts at master · BabylonJS/Babylon.js · GitHub
- Babylon.js/mesh.ts at master · BabylonJS/Babylon.js · GitHub
From my debugging, this happens when I dispose the last mesh in my scene, and only if the scene uses the
CascadedShadowGenerator, with non-default
numCascades (4 is fine, 2 and 3 crash). No issue if I don’t have this specific setup.
I have tried to create a repro case in the PG but did not manage.
Tagging @Evgeni_Popov as I’ve seen that you’ve done significant work on shadows in 4.2, so this might ring a bell to you ;).
I’m happy to help debug this more, but so far that’s all I could come up with. Also pointing out that this is not a major issue for me since I can simply put 4 cascades to fix it.