Disconnect when new scene is loaded

Options
I can not find solution using google so i will try to describe my issue here. I think my lobby scene should be the main problem but don't know where i made mistake.

I create scene which contains only one gameobject with this simple script:
public class MutliTest : MonoBehaviourPunCallbacks, IOnEventCallback
{
    void Awake()
    {
        PhotonNetwork.AddCallbackTarget(this);
    }

    public void OnEvent(EventData photonEvent)
    {
        Debug.Log(photonEvent.Code);
    }

    public override void OnPlayerPropertiesUpdate(Photon.Realtime.Player targetPlayer, Hashtable changedProps)
    {
        Debug.Log("OnPlayerPropertiesUpdate");
    }

    public override void OnDisconnected(DisconnectCause cause)
    {
        Debug.Log("<color=red> Disconnected: </color>" + cause);
    }

    public override void OnLeftRoom()
    {
        Debug.Log("OnLeftRoom");
    }

    public override void OnPlayerLeftRoom(Photon.Realtime.Player otherPlayer)
    {
        Debug.Log("OnPlayerLeftRoom");
    }

    public override void OnConnected()
    {
        Debug.Log("On connected");
    }

    public override void OnConnectedToMaster()
    {
        Debug.Log("On connected to maste");
    }

    public override void OnCustomAuthenticationFailed(string debugMessage)
    {
        Debug.Log("On OnCustomAuthenticationFailed");
    }

    public override void OnCustomAuthenticationResponse(Dictionary<string, object> data)
    {
        Debug.Log("OnCustomAuthenticationResponse");
    }

    public override void OnJoinedLobby()
    {
        Debug.Log("OnJoinedLobby");
    }

    public override void OnJoinedRoom()
    {
        Debug.Log("OnJoinedLobby");
    }

    public override void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
    {
        Debug.Log("OnRoomPropertiesUpdate");
    }

    public override void OnLobbyStatisticsUpdate(List<TypedLobbyInfo> lobbyStatistics)
    {
        Debug.Log("OnLobbyStatisticsUpdate");
    }

    public override void OnMasterClientSwitched(Photon.Realtime.Player newMasterClient)
    {
        Debug.Log("OnMasterClientSwitched");
    }

    public override void OnPlayerEnteredRoom(Photon.Realtime.Player newPlayer)
    {
        Debug.Log("OnPlayerEnteredRoom");
    }

    public override void OnCreateRoomFailed(short returnCode, string message)
    {
        Debug.Log("OnCreateRoomFailed");
    }


}

In lobby scene i use this part of code to start game:
private void StartGame()
    {
        PhotonNetwork.AutomaticallySyncScene = true;
        PhotonNetwork.CurrentRoom.IsOpen = false;
        PhotonNetwork.CurrentRoom.IsVisible = false;
        StorageDataManager.SinglePlayerMode = false;
        PhotonNetwork.LoadLevel(1);
    }


When I invoke StartGame method scene is change to game scene and in console window i only have these two messages:
First - "OnLeftRoom",
Second - "DisconnectByClientLogic".

What is really say me nothing.

Full debug information of first message:
OnLeftRoom
UnityEngine.Debug:Log(Object)
MutliTest:OnLeftRoom() (at Assets/MutliTest.cs:34)
Photon.Realtime.MatchMakingCallbacksContainer:OnLeftRoom() (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3576)
Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2586)
ExitGames.Client.Photon.<>c__DisplayClass105_0:<EnqueueStatusCallback>b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:931)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:431)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1598)
Photon.Pun.PhotonHandler:Dispatch() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:205)
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:139)

Full debug information of second message:
Disconnected: DisconnectByClientLogic
UnityEngine.Debug:Log(Object)
MutliTest:OnDisconnected(DisconnectCause) (at Assets/MutliTest.cs:29)
Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3479)
Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2598)
ExitGames.Client.Photon.<>c__DisplayClass105_0:<EnqueueStatusCallback>b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:931)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:431)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1598)
Photon.Pun.PhotonHandler:Dispatch() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:205)
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:139)

Well, i am not able to look what is going on in PhotonPeer.cs, EnetPeer etc.
My question is how could I know what is a potential cause of this issue?

Comments

  • Hylus
    Options
    Well, finally I find solution.
    I had stupid mistake which had been Disconnect method in OnDisable() callbacks :/
    Sorry for being idiot.