Hello ,
if i test this in the playgroud itโs work fine https://www.babylonjs-playground.com/#BCU1XR#804
but if i download it and try to work with it i get this problem
Thnaks for help
Hello ,
if i test this in the playgroud itโs work fine https://www.babylonjs-playground.com/#BCU1XR#804
but if i download it and try to work with it i get this problem
Thnaks for help
Yeah, this is due to the async nature of scene creation in the demo.
In the last lines of the html file you downloaded, you can find those lines:
scene = createScene();
engine.runRenderLoop(function () {
if (scene) {
scene.render();
}
});
// Resize
window.addEventListener("resize", function () {
engine.resize();
});
change that to:
createScene().then((scene) => {
engine.runRenderLoop(function () {
if (scene) {
scene.render();
}
});
// Resize
window.addEventListener("resize", function () {
engine.resize();
});
})
This should work.
You can read about async await and maybe implement it a bit better if you want
thannnnkks @RaananW