Why does my game window freeze after I click to change the scene?

Hi everyone!
I am new to Phaser. My problem is that when I click on the first scene , and then move on to the next scene, my game window freezes. Sometimes the game will start. Sometimes browser will alert that the website is not responding. Could someone please explain this problem and how to fix this?
Thanks!

Best regards,
Khoi

I can think of at least a couple of reasons why your window ā€œfreezesā€, but unless we get some code, Iā€™d be guessing.

How are you changing scenes?
If you can, use chromeā€™s performance tab to see whatā€™s going on.

If I had to venture a guess, you are either doing a very weird, long operation when switching scenes, or your scene creation takes too long (e.g: try creating 100 000 text gameObjects and youā€™ll see this ā€˜freezingā€™ going on too)

2 Likes

I think you may be right about it. However, I hope you can give my codes a look!
Here are my codes for the Scenes: my code. Hope you can check it out!
Thanks!

Hi,
Try to comment this.scene.stop(ā€œStartSceneā€);

//Click move to next scene
    this.input.on("pointerup", () => {
      // this.scene.stop("StartScene");
      this.scene.start("PlayScene");
    });
1 Like