An issue with SetActiveScene and Runner.shutdown

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

An issue with SetActiveScene and Runner.shutdown

gklyu
2023-04-01 07:50:19

Odd behavior... I have only 3 scenes in my loop: Menu, GetReady, Gameplay.

==========

  1. Menu scene
  • user inputs a session name

  • executes runner.StartGame to go to the GetReady scene

  1. GetReady scene
  • player prefabs are spawned.

  • sets DontDestroyOnLoad for all players

  • then executes runner.SetActiveScene to go to the Gameplay scene.

  1. Gameplay scene
  • contains a button to shutdown and destroy the runner, and return to the Menu scene.

=========

No problems on the first loop, until I click the button to shutdown and destroy the runner, and redo the loop.

When I reach the Gameplay scene the second time, I get the error:

[Fusion] [NetworkSceneManager] Network runner: Failed to switch scenes: System.InvalidOperationException: Failed to load scene [Scene:1]: async op failed at Fusion.NetworkSceneManagerDefault+d__5.MoveNext () [0x0014c] in /.../NetworkSceneManagerDefault.

===========================

Also, I only got this error after creating the GetReady scene, between the Menu and Gameplay scenes. Without the GetReady scene, the Menu scene executed runner.StartGame directly to the Gameplay scene and I could loop thru multiple times.

I cant figure out why switching scenes is failing after the first loop?

Thank you in advance for any help.

Comments

Isaac_Augusto
2023-04-10 11:48:14

Hi gklyu,

That's definitely odd, I don't see anything wrong.

The gameplay scene is the scene that has index 1? Can you share the full log? Also, if possible, describe better each step with code snippets can help us debugging.


Isaac Augusto

Photon Fusion Team

Back to top