Disconnection after loadScene

Hello, When i try to load a new scene some time it disconnects me from the room after loading the scene.
My code :
public override void OnJoinedRoom() {
// Debug.Log("Vous etes dans la Room");
PhotonNetwork.LoadLevel("MyGame");

}
-I am using Unity 2020.0f1
-The last version of Pun 2

Answers

  • maybe your room script is destroyed so try using DontDestroyOnload in the Start function or something
    i always do something like this :
    private void Awake()
        {
            DontDestroyOnLoad(this.gameObject);
            if (room == null)
            {
                room = this;
            }
            else if (room != this)
            {
                Destroy(room.gameObject);
                room = this;
            }
        }
    
    room is the roomScript so if your script that contains the room functions is called RoomManagement the room variable will be of type RoomManagement this also applies to the lobby script.
  • How long does the loading take? By default, the client will not keep the connection much longer than 30 seconds while loading, to avoid endless connections by accident.

    I would recommend to update from 2020.0 to a newer, more stable version of 2020. Maybe you do that and give it another try?
Sign In or Register to comment.