How to create two voice groups?

Hi. I'm a student developing a project using Photon Voice 2.

In my project there are two teams, each team has 4 Players. I need to have only two groups (one for team).

I'm doing the toggle this way:


if (punVoiceClient.Client.GlobalInterestGroup == 0)

    { 

   this.photonVoiceView.RecorderInUse.InterestGroup = 1;

      this.punVoiceClient.Client.GlobalInterestGroup = 1;

   }

The problem is that only one player can perform this group change.

I believe the problem is related to PhotonView, because Photon Pun Client is only accessible to one of the players.

 Among all the players, there is only 1 client? Can I use punVoiceClient.Client.GlobalInterestGroup for all Players? Could the problem be that the gameObject containing the PunVoiceClient is already in the scene when starting?


 Looking forward to your reply, thanks in advance!

Best Answer

  • vadim
    vadim mod
    edited November 7 Answer ✓

    Hi,

    When you set Client.GlobalInterestGroup, the client subscribes to the given group and when you set Recorder.InterestGroup, the client sends all outgoing audio messages for this recorder to this group. So changing group always affects only the client doing this change.

    Change group on each client as soon as it realizes to which group it belongs to, e.g. when the player chooses the team.

Answers

  • vadim
    vadim mod
    edited November 7 Answer ✓

    Hi,

    When you set Client.GlobalInterestGroup, the client subscribes to the given group and when you set Recorder.InterestGroup, the client sends all outgoing audio messages for this recorder to this group. So changing group always affects only the client doing this change.

    Change group on each client as soon as it realizes to which group it belongs to, e.g. when the player chooses the team.