Infinite Connection Loop

Hey all,

I am working on adding voice chat to a basic VR multiplayer scene. I am on 2019.3 using PUN 2 and the Unity XR Interaction toolkit.

the scene is setup as follows:
AppID is set for PUN and Voice
a game object in the scene with a voice network and recorder. recorder is set to primary recorder. auto connect, start, transmit etc are all on

the prefab (which is instantiated by PUN) has a voice view and a speaker child. it is set to use primary recorder. the speaker is set in the voice view to the child.

when the scene loads, the log ends up in an infinite loop of connecting and disconnecting to photon voice. Testing the app (in editor, on HTC Vive Pro, and Oculus Quest) does not have any voice transmitting.

I'm sure I'm making a silly mistake, but i would appreciate some assistance in figuring this out.

mlv22oj.jpg

Comments

  • I also started encountering this same issue today. I have not changed anything in the Voice settings or my networking code. Maybe it is server issues?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @ADHDFL, @luckyjustlucky,

    Thank you for choosing Photon!

    What Photon Voice version is this?
    Does this happen with the PunVoiceDemo scene?
    Does this happen if you choose a different AppId for Voice?
    What region? could you switch to another "fixed region" and retry?

    To debug join room issues for voice client enable Support Logger from PhotonVoiceNetwork, before that change OnJoinRoomFailed in "Assets\Photon\PhotonRealtime\Code\SupportLogger.cs" to:
    public void OnJoinRoomFailed(short returnCode, string message)
            {
                Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnJoinRoomFailed(" + returnCode+","+message+").");
            }
    
  • JohnTube wrote: »
    Hi @ADHDFL, @luckyjustlucky,

    Thank you for choosing Photon!

    What Photon Voice version is this?
    Does this happen with the PunVoiceDemo scene?
    Does this happen if you choose a different AppId for Voice?
    What region? could you switch to another "fixed region" and retry?

    To debug join room issues for voice client enable Support Logger from PhotonVoiceNetwork, before that change OnJoinRoomFailed in "Assets\Photon\PhotonRealtime\Code\SupportLogger.cs" to:
    public void OnJoinRoomFailed(short returnCode, string message)
            {
                Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnJoinRoomFailed(" + returnCode+","+message+").");
            }
    

    Hi @JohnTube :

    version: 2.15
    this does not happen in the demo scene, it functions as expected.
    a new appID has no effect
    US Region

    adding that debug code does not change the output. however now sometimes instead of giving me the same infinite loop, i get these warnings:

    AdxWQ9B.png
  • Thanks for the response.

    It happens with different and same AppId for me. The PunVoiceDemo works for me. I cleared the App Version setting from the PhotonServerSettings and it connects now. Below are my settings:

    Pun settings:
    Pun: 2.16 Photon lib: 4.1.3.0 Voice: 2.15
    Dev region: usw
  • I spoke too soon. It connected one time. I have not been able to connect after that.
  • @ADHDFL,

    I found that a PhotonVoiceNetwork singleton would be created when my game object had a photon voice view on it. I was using the same game object on my start scene where no networking took place. My workaround was to create a copy of the game object without the photon views. Then I would just use a normal unity LoadScene to load the networked scene. I made setup in the network scene similar to the PunVoiceDemo. My voice connects every time now.

    Hope it helps.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @luckyjustlucky,

    Could you explain what was wrong and how you fixed it? Maybe with screenshots?
    You mean you were adding PhotonVoiceNetwork to a prefab?

    Hi @ADHDFL,

    The warning is unrelated to the original issue but it's also unexpected and should not happen.
    Do you have minimal repro steps?
    This means that the Recorder was initialized and started recording before the PhotonVoiceView finishes the setup.

    In the original screenshot, I need the full stack trace of
    "OnVoiceStateChanged from Joining to DisconnectingFromGameServer".
  • @JohnTube

    the issue was fixed by following the advice of @luckyjustlucky . By removing the photon voice view and associated scripts from my non-networked menu avatar it was able to connect successfully. the two warnings in my second post where from having debug echo on but not debug speaker.
  • JohnTube wrote: »
    Hi @luckyjustlucky,

    Could you explain what was wrong and how you fixed it? Maybe with screenshots?
    You mean you were adding PhotonVoiceNetwork to a prefab?

    Hi @JohnTube,

    My game has a single player scene which is also the starting point for multiplayer. I was using the same prefab for both my single and networked player. That prefab contained the PhotonView and PhotonVoiceView. I had the single player scene create the connection to the room then on success it would load the network scene (similar to how the PUN Basics Tutorial does it). When I loaded the networked scene the PhotonVoiceNetwork would connect the first time, but anytime after stopping the player it would get stuck in the "connecting loop."

    My fix was to create two separate prefabs one for the single player and one for the network player. I also removed the network code from my single player scene. All the networking happens in the network scene.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hey @luckyjustlucky @ADHDFL,

    I want to fix this issue so it doesn't happen to others.
    However, I could not reproduce, tried having Voice components in the scene from compile time or PUN's OfflineMode but no luck.
    Could you help me by sending a minimal repro project here, maybe as a .unitypackage over dropbox or Google Drive or else?
    Thanks.
  • Yeah, give me a few days.