const engine = new BABYLON.Engine();
this.scene = new BABYLON.Scene(engine);
and the error is
TypeError: Cannot read property 'trackUbosInFrame' of undefined
at new e (https://preview.babylonjs.com/babylon.js:16:635642)
at t._createUbo (https://preview.babylonjs.com/babylon.js:16:237048)
at new t (https://preview.babylonjs.com/babylon.js:16:226446)
...
I now see that in some specs we construct the Engine without a canvas. We don’t nee a canvas for this spec and for many of the specs. There are no materials involved in the spec. The whole spec after that is
this.scene = new BABYLON.Scene(engine);
this.stepBabylonNode = new BABYLON.Node("node", this.scene);
this.stepBabylonNode.metadata = {
...
};
const node = this.scene.getNodeByID("node")
expect(...that we can read metadata from the node...)
I checked if the constructor for Engine requires a canvas and it is
new Engine(canvasOrContext: Nullable<HTMLCanvasElement | WebGLRenderingContext>,
It is Nullable. It should be possible to pass null?
Thanks.
I would try to reproduce it in playground, I will have to see how to construct an engine there .
TypeError: Cannot read property 'trackUbosInFrame' of undefined
at new e (babylon.js:16)
at t._createUbo (babylon.js:16)
at new t (babylon.js:16)
at createScene (<anonymous>:4:17)
at <anonymous>:40:9
at Function.e.FastEval (babylon.playground.js:16)
at t.<anonymous> (babylon.playground.js:16)
at babylon.playground.js:16
at Object.next (babylon.playground.js:16)
at s (babylon.playground.js:16)
Is this still an issue in 5.0.0-alpha.5? I’m trying to test WebGPUEngine in Chrome Canary (Version 89.0.4358.2 (Official Build) canary (arm64)) - I have #enable-unsafe-webgpu enabled & some other WebGPU sample pages work without issues.
Repro here - Babylon.js Playground passing in the existing canvas to WebGPUEngine as well.
I was able to repro w/ an x86_64 build of Chrome Canary on another machine as well, so I don’t believe its due to arm architecture differences.
Yep that resolves this property issue - I must have missed reading about await engine.initAsync();.
Updated playground fixing initAsync here https://playground.babylonjs.com/#KKHTA3#1 - it doesn’t render probably because playground isn’t meant to have an async createScene fn.
I would advise you to wait on the final support for webgpu as it is currently not available in playground and here you are trying to use is on an engine with a webglcontext already created. You won t be able to use it in the playground like this.
Update: I think I figured it out. The problem was that my script was trying to create an engine before the canvas required was loaded. So I edited it so that the script loads after all the document elements has been finished loading or created.