When creating a new NullEngine instance, it isn’t getting added to the EngineStore.Instances array, so there is no global reference to the NullEngine.
Here’s a playground example: Babylon.js Playground
Looking through the code, it looks like the Engine class returns immediately if the canvas is null (which the NullEngine does). I see two possible solutions:
-
The Engine.Instances.push(this) code gets moved to above the if canvas check. However, I’m unsure if that would be problematic in the case where an Engine is created specifically with a null Canvas, as the new Engine instance would be unusable and probably shouldn’t be added to the Instances array.
-
The Engine.Instances.push(this) is added to the NullEngine constructor. Probably the best solution in this case imo.
Assuming this is a bug, I don’t mind making a PR and fixing it, however, I’m unsure where to begin (I’ve never contributed to an open source project before lol).