Photon Voice not working in my version of Pun-Basic tutorial scene

Fairly new to Photon but have got a multiplayer app working well, including photon chat. I've tried the photon Voice demo and that works for me too.

However when I tried to add Photon Voice to my existing app it won't work. My app is based on the Basic Tutorial project, with a Launch scene which then opens a Room in a different scene (in my case it's always the same scene, I'm not using different scenes depending on the number of players)

I've placed a copy of the Voice gameObject (with PushToTalk and PhotonVoiceSettings scripts attached) as well as the Push to talk button into my scene. But no audio comes out. The console displays an error:
PUNVoice: Attempt to create multiple instances of PhotonVoiceSettings
after the PUN Room is loaded but before the player is instantiated:

I then tried using the GUI debugging script from the TestVoice scene (I removed ConnectAndJoinRandom and OnJoinedInstantiate as this is already being taken care of in my scene.
Same error but I'm getting a little bit more feedback from the GUI:

After clicking 'Connect' in the Photon Voice section of the GUI I get an additional Warning in the console:
PUN Voice: Got an unexpected Disconnect in Load Balancing Client
After having had a look at other posts in the forum, I'm wondering whether the problem is to do with the timing of the instantiation of the Photon Voice singleton? Do I need to delay the voice functionality until after my player is instantiated?

If so, how would I go about it?

Any help much appreciated!


  • Hi @baroquedub,

    Thanks for the detailed report.
    Which Photon Voice package version do you use?
    Regarding "PhotonVoiceSettings" multiple singleton instances error, where and when do you instantiate that in the scene?
  • I downloaded Photon Voice just a few days ago from the asset store, so it'll be the latest version; Version: 1.7 (Sep 30, 2016)

    Re. where and when do I instantiate the singleton; the singleton instantiates itself regardless of which scene I'm running. So now that Photon Voice is in my project, if I run any scene (whether it has photon scripts in it or not) the singleton appears in the hierarchy, at runtime. I assume this is normal?

    I've copied the Voice gameObject from the Push-to-talk demo which has the Push-to-talk script as well as the Photon Voice Settings. I tried removing the Photon Voice settings (in case this was the duplicate) and it does stop the Duplicate Error. However voice still doesn't work, and with the GUI, trying to connect I see the same unexpected Disconnect:
    PUNVoice: Got a unexpected Disconnect in LoadBalancingClient State: Joined.    at ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnStatusChanged(StatusCode statusCode) in J:\_UNITY Projects\___NEW\Network Tutorial Photon Simplified - VR\Assets\Plugins\PhotonLoadbalancingApi\LoadBalancingClient.cs:line 2242
    at ExitGames.Client.Photon.EnetPeer.Disconnect()
    at ExitGames.Client.Photon.PhotonPeer.Disconnect()
    at ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.ConnectToRegionMaster(System.String region) in J:\_UNITY Projects\___NEW\Network Tutorial Photon Simplified - VR\Assets\Plugins\PhotonLoadbalancingApi\LoadBalancingClient.cs:line 759
    at PhotonVoiceNetwork.Connect() in J:\_UNITY Projects\___NEW\Network Tutorial Photon Simplified - VR\Assets\PUNVoice\Scripts\PhotonVoiceNetwork.cs:line 117
    at Gui.OnGUI() in J:\_UNITY Projects\___NEW\Network Tutorial Photon Simplified - VR\Assets\PUNVoice\TestVoice\Gui.cs:line 107
    UnityVoiceFrontend:DebugReturn(DebugLevel, String) (at Assets/PUNVoice/Scripts/PhotonVoiceNetwork.cs:358)
    ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Plugins/PhotonLoadbalancingApi/LoadBalancingClient.cs:2244)
    ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:ConnectToRegionMaster(String) (at Assets/Plugins/PhotonLoadbalancingApi/LoadBalancingClient.cs:759)
    PhotonVoiceNetwork:Connect() (at Assets/PUNVoice/Scripts/PhotonVoiceNetwork.cs:117)
    Gui:OnGUI() (at Assets/PUNVoice/TestVoice/Gui.cs:107)
    Any thoughts?
  • I assume this is normal?

    Yes that is the expected behavior.

    From the stack trace it looks like connection to master server is failing and according to the state you are actually joined to a voice room!
    It looks like you are trying to connect to Photon Voice while you are already joined to a voice room.
    Please check the values of "AutoConnect" in "PhotonVoiceSettings" if you do not want Photon Voice to automatically follow PUN's connection flow then you should keep a "PhotonVoiceSettings" instance in the scene and set "AutoConnect" to false.
Sign In or Register to comment.