Critical exception: "get_clip can only be called from the main thread" exception in Unity 2017.3

This is a bug that makes Photon Voice unusable in Unity 2017.3 (I recently upgraded from Unity 5.4 and haven't tested this with any version in between). I use the latest available Photon Voice: version 1.3

To reproduce simply use Photon Voice's demo scene (DemoVoice-Scene). Play with two players in the scene and start speaking in your microphone. The following error message appears:

get_clip can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.AudioSource:get_clip()
AudioStreamPlayer:OnAudioFrame(Single[]) (at Assets/Imported_Items/PUNVoice/Scripts/AudioStreamPlayer.cs:191)
PhotonVoiceSpeaker:OnAudioFrame(Single[]) (at Assets/Imported_Items/PUNVoice/Scripts/PhotonVoiceSpeaker.cs:65)
UnityVoiceFrontend:OnAudioFrame(Int32, Byte, Single[]) (at Assets/Imported_Items/PUNVoice/Scripts/PhotonVoiceNetwork.cs:530)
c__AnonStorey0:<>m__0(Single[]) (at Assets/Imported_Items/PUNVoice/Scripts/PhotonVoiceNetwork.cs:435)
ExitGames.Client.Photon.Voice.RemoteVoice:decodeFrame(IDecoder, Byte[]) (at Assets/Plugins/PhotonVoiceApi/Core/Voice.cs:377)
ExitGames.Client.Photon.Voice.RemoteVoice:decodeThread(IDecoder) (at Assets/Plugins/PhotonVoiceApi/Core/Voice.cs:325)
ExitGames.Client.Photon.Voice.RemoteVoice:m__0() (at Assets/Plugins/PhotonVoiceApi/Core/Voice.cs:227)


Please advise how to fix this, thanks!

Comments

  • Ok I fixed this. I deleted all Photon Voice assets from the project and re-imported the package and it fixed it so probably was due to some code being used from a former version of the package.
Sign In or Register to comment.