Voice chat in Unity help needed!
I post this here as well, because I have no Idea which of the caregories it should go into.
I'm trieing for days to make use of the photon voice chat app. However, it's not working so far. The setup should be ok(?) I made an App and connected with the PUN Wizard. I have the App Id for PUN and the App ID for Voice connected, Checked "User Name Server", "Port 0", "Protocol: UPD", "Protocol Fallback", "Run in Background". Pretty much the default settings with my App Id. Is there more I have to setup?
First of all. I have a game already, I do not want to use anything from photon other than the voice chat!
My player setup is identical to the "Prefab Setup (PhotonVoiceView)" here:
In my project the player gets created on gamestart like:
player = Instantiate(playerPrefab).transform;
When I run the game photon is not working, throwing only one error, no recorder initialized:
NullReferenceException: Object reference not set to an instance of an object
Photon.Voice.Unity.Recorder.CreateLocalVoiceAudioAndSource () (at Assets/Photon/PhotonVoice/Code/Recorder.cs:1778)
So I tried to initialize the recorder, but the documentation is very spare about it.
and both didn't help in any way of course.
Searching the forums I found an other way to instanziate, like:
player = PhotonNetwork.Instantiate(this.playerPrefab.name)
I was wondering why this functions need a string and how it is suppost to work. Anyways I changed it to:
player = PhotonNetwork.Instantiate(playerPrefab.name, new Vector3(0f, 0f, 0f), Quaternion.identity, 0).transform;
Didn't work and after more research i found that the prefabs should be in a resource folder, so I moved them, but it did not help. On more search I found this page: https://doc.photonengine.com/zh-cn/pun/current/demos-and-tutorials/pun-basics-tutorial/player-instantiation#instantiating_the_player
Won't work for me either. I can not easily set it up like this, because I handle the player actions in my own script already. I tried to make the instanziation in my script but it dosn't woirk (of course) because the photon engine isn't ready.
So I was really wondering what else I could do. Damn, this is a million times more complicated than advertised. Any help would be appriciated. I have no ideas anymore, other than trying out different frameworks.