Hi,
I am getting this error when I am loading a javascript file from my code. I assume its related to async loading. Here I have created the scene async, but it does not fix the issue.
The error i am getting is:
Uncaught TypeError: this._scene.getUniqueId is not a function
And here is my create scene function:
var createScene = async function () {
var scene = new BABYLON.Scene(engine);
...
...
};
window.initFunction = async function () {
var asyncEngineCreation = async function () {
try {
return createDefaultEngine();
} catch (e) {
console.log("the available createEngine function failed. Creating the default engine instead");
return createDefaultEngine();
}
}
window.engine = await asyncEngineCreation();
if (!engine) throw 'engine should not be null.';
window.scene = createScene();
};
initFunction().then(() => {
scene.then(returnedScene => { sceneToRender = returnedScene; });
engine.runRenderLoop(function () {
if (sceneToRender && sceneToRender.activeCamera) {
sceneToRender.render();
}
});
});