Photon Voice 2.0 causing Unity to freeze

Anyone else getting this bug?

I'm using Unity 2018.2.13, but I've also tested on 2018.2.6 and had the same effect.

When I try to run Photon Voice 2.0 in my scene, it'll sometimes cause Unity to freeze up when I click on the play button. It seems that the first time I try to run it, it works fine, but any subsequent time, it'll freeze up. Sometimes it doesn't seem to follow this pattern so I'm very bewildered.

This bug seems to happen in the example PUN demo that's provided in the asset, but the minimal demo and the UI demo do not seem to have this bug.

Any ideas as to what's going on here?


  • Exact same problem I'm having. Hopefully it will be fixed in the release version of voice 2.

    For the devs, is there a rough date on when the release version will be out?
  • One point to add is that it seems that if I "leave room" instead of just unclicking the play button, it won't cause this freeze upon the next run.
  • Hey @CheeseBrownie, @PygmalionTheus,

    We are currently actively looking into this issue and we are trying to fix it once and for all.
    We will be posting updates here.
  • JohnTube
    JohnTube mod
    edited November 2018
    Hey @CheeseBrownie, @PygmalionTheus,

    Could you try this patched Photon Voice 2 version and see if you still get the Unity Editor to freeze?
  • Hi @JohnTube , I've imported the patch, it seemed to have an issue with a dll in the library folder, so I deleted my existing PhotonVoice folder in my project before importing the patch again.

    I tried running the Demo Pun Scene, and after 2 plays, the 3rd one froze again.

    The mic I'm using is from my Oculus Rift. My plan is to add Photon Voice 2.0 to my VR game.
  • Hi @PygmalionTheus,

    Thanks for the update, we will investigate further.
  • I didn't have a dll issue like PygmalionTheus but Unity is still freezing on my second or third play on the demo and my own project.
  • JohnTube
    JohnTube mod
    edited November 2018
    hey @CheeseBrownie and @PygmalionTheus

    Could you re download, import again and test please?
  • CheeseBrownie
    edited November 2018
    @JohnTube I made a new project, imported the package, got errors and can't press play.

    I get these errors in the console:

    Assembly has reference to non-existent assembly 'PhotonVoice.API' (Assets/Photon/PhotonVoice/Code/Editor/PhotonVoice.Editor.asmdef)


    AssemblyDefinitionException: Could not find assembly reference 'PhotonVoice.API'
    UnityEditor.AssemblyDefinitionImporterInspector.LoadAssemblyDefintionState (System.String path) (at C:/buildslave/unity/build/Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs:449)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
  • PygmalionTheus
    edited November 2018
    @JohnTube, Importing gave me this error (same error I got the last time I tried importing. I only have PUN 2.0 and Photon Voice 2.0 installed):

    After clicking on "cancel" to the above prompt, the import finishes. I'm then presented with the following errors in my console (seems to be the same one as @CheeseBrownie):

    Removing the offending lines only leads to more errors, so I stopped here.
  • Hi @PygmalionTheus, @CheeseBrownie,

    Thank you for trying this and sorry for the issues.

    About the import errors:

    1. Please read the "Native Library Updates" Known Issue
    2. The other errors are related to the newly added Assembly Definitions (> 2017.3). I will investigate and fix them.
  • My game is a VR game for the Vive and Rift, I see no Freeze/Crash on the Vive, but when I test with the Rift, I'm seeing the game freezing briefly, and then crashing. I put in some debug statements, and it looks like within the MicWrapper constructor, the crash happens in:
    this.mic = Microphone.Start(device, true, 1, frequency);
  • JohnTube
    JohnTube mod
    edited November 2018
    Hi @PygmalionTheus, @CheeseBrownie,

    Could you try again using this updated package version? Sorry for the inconvenience and thank you for your time and help.

    hi @BuilderWorldVR,

    Thank you for choosing Photon!
    Do you use Photon Voice 1 or Photon Voice 2?
    If Photon Voice 1 what version?
    What Unity version are you using?
  • BuilderWorldVR
    edited November 2018
    Hi, I'm using Unity 2018.2.8f1 and PUN 2 and Photon Voice 2
  • @JohnTube I imported the updated package to a new project on 2018.1.0f2 and didn't have much of a problem. But when I switched to 2018.2.3f1 I started getting this error:

    DllNotFoundException: opus_egpv
    POpusCodec.Wrapper.opus_encoder_create (SamplingRate Fs, Channels channels, OpusApplicationType application) (at Assets/Photon/PhotonVoice/PhotonVoiceApi/Core/POpusCodec/OpusWrapper.cs:78)

    I should also add that I too am making a VR game and have imported SteamVR to the project. I did a test with Unity 2018.2.3f1 without SteamVR, ran the Voice Demo and it didn't freeze. but once I imported SteamVR it would freeze after the second or third time I press play. Don't know if I'm the only one getting this result. Would be awesome if @PygmalionTheus or anyone else can test with and without SteamVR.
  • BuilderWorldVR
    edited November 2018
    FYI, I'm also speaking to the support team via email. Thanks to Hamza and Tobias for the great support. It was suggested that I try using the Photon Microphone instead of the Unity Microphone. Making this change eliminated the freezing and crashing, so it's something others may want to try. Now my only remaining problem is that when I test with 2 players entering a room, only the 2nd player entering is able to be heard. The first player to enter cannot be heard by the 2nd. Pretty weird! It's so close to working, but I just have this one remaining issue.
  • I have the exact same problem as well.

    using Unity-2018.2.10f, Pun2 + Voice 2

    Downloaded your latest package @JohnTube mod

    Could no longer find the opus lib. I see you removed it from the x86 64 folder.

    @BuilderWorldVR Switching to Photon Microphone did not fix it for me.
  • JohnTube
    JohnTube mod
    edited November 2018
    Hi @Dipiis,

    Thank you for choosing Photon!

    Could no longer find the opus lib. I see you removed it from the x86 64 folder.
    It was not intentional, happened by mistake! Sorry about that.

    Hey everyone,

    Please download the new updated package here.
    Please be careful when importing: Unity Editor "Native Library Updates".
    I recommend testing in a clean/fresh/new/empty project.

    I want to focus on the Unity Editor freezing issue here.
    Regarding other errors or crashes either start a new discussion or search in the forum if there is one already. For instance, there is this Bug Report here.
  • @JohnTube

    Tried in new project: Got a 200 errors.
    Started another new project, downloaded Pun2 then imported your package:

    Assets/Photon/PhotonVoice/Code/Recorder.cs(107,72): error CS1729: The type `UnityEngine.Logger' does not contain a constructor that takes `0' arguments

    Assets/Photon/PhotonVoice/Code/Recorder.cs(107,50): error CS1502: The best overloaded method match for `Photon.Voice.AudioInEnumerator.AudioInEnumerator(Photon.Voice.ILogger)' has some invalid arguments

    Assets/Photon/PhotonVoice/Code/Recorder.cs(107,72): error CS1503: Argument `#1' cannot convert `UnityEngine.Logger' expression to type `Photon.Voice.ILogger'

    Got the same three errors in my own project as well.
  • JohnTube
    JohnTube mod
    edited November 2018
    Hey @Dipiis,

    downloaded Pun2 then imported your package:
    Importing PUN2 separately is not needed. PUN2 is included in Photon Voice 2. Photon Chat as well.

    What OS are you using and what target platform?
  • JohnTube
    JohnTube mod
    edited November 2018
    the package has been updated once more.
    I made sure to test using Unity 5.6.0f3 and Unity 2018.2.2f1.
    thank you for your patience, cooperation and understanding.

    To update no need to import PUN2...
    Preferably start new or delete old assets before importing.
  • @JohnTube

    I use Windows 10.
    Target platform windows only.

    I didnt think I would either, but got a ton off missing references, but will try with new package tomorrow and get back to you.
  • @JohnTube

    No sticking errors any longer, but get this now:

    PlayerSettings Validation: Requested build target group (20) doesn't exist; #define symbols for scripting won't be added.

    Maybe not a problem as I only get it once.

    I still have to go into PhotonVoiceLibs/x86/opus_egpv and disable the x86 64 platform to be able to build, due to duplicate in other folder.

    But it still ends up freezing the editor after some amount of plays

    (Btw, I am also developing for VR (Vive) as some other users did above)

  • @JohnTube

    Completely new project. Installed package. Froze on second play attempt.
  • JohnTube
    JohnTube mod
    edited November 2018
    hey @Dipiis,

    We have updated Photon Voice to 2.1 now, no need for that unreleased package version from Dropbox anymore.
    So you are using Unity-2018.2.10f, right?
    Mac, Windows or Linux? or the editor freezing happens on more than one OS?
    Which target platform? or the editor freezing happens on more than one target platform?

    Could you confirm the following:

    - In a clean/fresh/new/empty project
    - You import Photon Voice 2.1 only (do not import any other asset)
    - In one of the demos scenes, the freezing happens when you enter play mode multiple times? or you need to force code compilation by changing and saving the code?

    Could you check if "Photon/PhotonVoice/Code/Editor/ExitPlayModeOnCompilation.cs" exists?
  • Dipiis
    edited November 2018

    Unity-2018.2.10f Correct

    Windows 10, only testing on Windows 10. Target platform PC/Windows 64 bit

    Yes, I tried to do as little as possible, completely fresh project with ONLY Photon Voice 2.1 package you gave me.

    Didnt touch any code. Just used your demo scene and entered play mode twice and it froze on the second

    ExitPlayModeOnCompilation.cs does NOT exist.
    ExitPlayModeOnScriptCompile.cs does however

    (But that came with the package you gave me)

    Reminder: Got error below on dropbox package:
    PlayerSettings Validation: Requested build target group (20) doesn't exist; #define symbols for scripting won't be added.

    Will try the official download tomorrow.
  • We are using unity 2017.4.15 (LTS) and Photon 2.1.
    We also notice crashes when we are making use of Photon voice.
    The Unity Editor keeps freezing the second time we press Play. Without voice our scene is perfectly fine.
    We tried to reimport after restarting unity without pressing play to avoid issues with the library imports. We tried to put the microphone on Photon instead of Unity. Unfortunately we keep having this issue.
    The same issue also arose in the DemoVoicePun-Scene (Freezes after 2-3 times using the play-stop button in the unity editor.)
    Is there anything else we could try?
  • @JohnTube we've isolated the crash to the Recorder initialization. Manually calling GetComponent().Init() before joining a room causes a crash. I'm guessing that similar code is automatically called when joining to a room, because the game also crashes then.

    Also guessing that Recorder initialization interfaces with AudioIn.dll (Windows) and audioinaec.aar (Android) because changing these libraries affects this crash behavior.

    We're running Unity 2018.2.16f1 and Photon Voice 2.1
  • hi @date,

    thank you for choosing Photon and for your report!
    we're actively investigating this issue.

    hi @john__primitive

    Could you start a separate forum discussion about this as crashes are different from Unity Editor freezing?
    Also in the new discussion provide any crash log/report/dump and tell us if the crash happens in the Unity Editor or using build(s) on actual device(s)? And what platforms does the crash happen on? Windows and Android only? If you also happen to have minimal repro steps to trigger the crash that would be very good to have. Does the crash happen on any of the demos provided in the package?
  • hi @date @Dipiis @PygmalionTheus @CheeseBrownie

    I have submitted Photon Voice 2.1.1 to the asset store, once it's live could you test it and see if the freezing is still there?