How to restart a scene in babylon.js?
Hello everyone, I’m doing a practice with babylon.js and I can’t find a way to restart a scene.
That is, in godot Engine or unit it is quite simple since there are functions that allow you to restart a scene easily
In the case of Godot take the hierarchy and restart the nodes
In the case of unity it has a function called scene manager that allows you to “restart” or change the scenes using a scene as a reference.
Is there a simple way to restart or change scenes in babylon.js ?.
use a public variable called game over and try this but it doesn’t work
window.addEventListener("click", function () {
//si es GameOver
if(gameOver)
{
console.log("tendria que reiniciar la escena")
gameOver = false;
}
});
/////////////////// Init game ////////////////////////////
var scene = createScene(); //Call the createScene function
// Register a render loop to repeatedly render the scene
engine.runRenderLoop(function () {
//
if(gameOver)
{
//console.log("tendria que reiniciar la escena")
scene.dispose()
}
else
{
scene.render();
}
});