Script errors upon re-switching back to a scene

  1. I press play on the Home scene.


It triggers this, which causes you to switch to the Game scene
Screenshot 2024-07-09 at 18.22.56

  1. This works just fine, and you can start to play the game

  2. Once the match is over, I send the player back to the home screen
    Screenshot 2024-07-09 at 18.30.09

  3. Once back on the home screen, this is where the issues begin:


Clicking play again triggers the same code to load the Game sceen as last time.

However once the scene switches, I get these errors:

This comes from my networkManager script, which recieves the player as an attribute. However it looks like it can’t access this player the second time around. The networkManager comes from this tutorial (see project)

I’ve tried changing initialize() to postInitialize but it won’t work. I’m just really confused as to what’s going on, any hint would be greatly appreciated :slightly_smiling_face:

Hi @marble!

I’m unable to find a networkManager script in the project you shared.

Sorry for the late response,

It’s in here

But I don’t think it’s a networking problem. I suspect it’s something to do with re-initializing scripts when you reload the scene?