Change scene with window.scene


#1

Hello,

i have set

window.scene = runtimeScene;

at the beginning of the scene.

Now i would like to change the scene from outside the game. So i tested from Browser console.

window.scene.requestChange(gdjs.RuntimeScene.REPLACE_SCENE, “level2”);

window.scene.requestChange(gdjs.RuntimeScene.PUSH_SCENE, “level2”);

But none of them are working. When i use these commands at the beginning of the scene, they work correctly.

Any help apreciated.

Regards

Chris


#2

when i am checking

window.scene.getGame().getSceneStack()._stack[0]

i can see

_requestedChange: 0
_requestedScene: “level2”