voice not working after switching scenes

edited November 22 in Photon Voice
when I switch the scenes voice is not working and it shows the error as,

OnDisconnected cause=DisconnectByServer
UnityEngine.Debug:LogErrorFormat(String, Object[])
Photon.Voice.Unity.UtilityScripts.ConnectAndJoin:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonVoice/Code/UtilityScripts/ConnectAndJoin.cs:155)
Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3240)
Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2371)
ExitGames.Client.Photon.<>c__DisplayClass100_0:b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:893)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:429)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1428)
Photon.Voice.Unity.VoiceConnection:FixedUpdate() (at Assets/Photon/PhotonVoice/Code/VoiceConnection.cs:304)

Comments

  • Hi @Arivazhagan,

    Thank you for choosing Photon!

    You need to set the GameObject to which the VoiceConnection script is attached to as DontDestroyOnLoad so it persists across scenes.
    If you use PhotonVoiceNetwork it has this option built-in.

    But I doubt that your issue is related to scene switching as if it was the case the DisconnectCause would be TimeoutDisconnect.
    Make sure you are not sending too much to the server.
  • Can I know when the error will come as DisconnectByServer?
  • Hi @Arivazhagan,

    What do you mean?
    I have checked the code of DisconnectCause and it seems I was wrong about something:
    /// <summary>OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgements from the client).</summary>
            ServerTimeout,
            /// <summary>OnStatusChanged: The server disconnected this client. Most likely the server's send buffer is full (receiving too much from other clients).</summary>
            [Obsolete("Replace with: ServerTimeout (same value).")]
            DisconnectByServer = ServerTimeout,
    /// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time.</summary>
            ClientTimeout,
            /// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time.</summary>
            [Obsolete("Replace with: ClientTimeout (same value).")]
            TimeoutDisconnect = ClientTimeout,
    DisconnectByServer is now obsolete and replaced with ServerTimeout.
    The TimeoutDisconnect is also obsolete is replaced with ClientTimeout.

    Loading level can take too much time (> 10 seconds) during which the server will disconnect the client if the latter "does not show any sign of life" (reply or send back ACKs to the server).
    So the solution is to have the GameObject to which VoiceConnection (or PhotonVoiceNetwork) component attached set as DontDestroyOnLoad to persist between scenes.
  • edited December 4
    Yeah I set it on DontDestroyonload, But I'm having the error
  • Hi @Arivazhagan,

    I managed to reproduce and I'm trying to fix this.
    Will post an update here if I make it work as expected.
    Sorry for the inconvenience!
  • Hi @Arivazhagan,

    Could you try replacing "Photon/PhotonVoice/Code/VoiceConnection.cs" with this and test again?
  • yeah, It's working...thanks for your support.
  • Thank you for your help!
    We will include this fix in the next update.
  • FYI:
    This was fixed in Photon Voice 2.1.3.
Sign In or Register to comment.