0
\$\begingroup\$

I'm creating a pause menu for my game and I have two scenes: a menu scene (Scene1) and a game scene (Scene2). I load them using the command 'SceneManager.LoadScene(1);' for the menu scene and 'SceneManager.LoadScene(2);' for the game scene.

The game mission opens successfully when I transition from the menu scene to the game scene for the first time. However, if I pause the game and return to the menu scene, and then try to go back to the game scene, the game freezes. This problem also occurs in the build version of the game.

Upon deep profiling, I found that the second 'WaitForAsyncOperationToComplete()' call is making expensive calls. I have tried minimizing my 'Start()' and 'Awake()' methods, but nothing seems to work.

I've attached some screenshots Screenshot 2 Screenshot 1

\$\endgroup\$
2
  • \$\begingroup\$ Does the game permanently freeze, or does it freeze for some time and then eventually continue? If it's permanently freezing, it's possible that there's a problem with your code, or there could be a bug in the Editor/engine. What version are you using? The first troubleshooting step is often to upgrade to the latest LTS version of your Unity branch. For example, if you're using 2021.2.4f1, you should seriously upgrading to 2021.3.25f1 (currently the latest LTS version). \$\endgroup\$
    – Kevin
    Commented May 15, 2023 at 19:41
  • \$\begingroup\$ Thanks for the reply currently I'm using LTS version 2021.3.22f1 will update to .25f1 and report back to you :) and yeah it permanently freezes \$\endgroup\$ Commented May 16, 2023 at 1:46

0

You must log in to answer this question.

Browse other questions tagged .