How to talk from all player to one player?

I just want all the players to talk to the player 1 which joins and creates the room. Using the Push to talk btn script. How to get the players who join only talk to the first player and not others using the script.

Best Answer

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Deadking99,

    The MasterClient or room creator or actor number 1 should subscribe to an audio group X (e.g. 1).
    All other players should not subscribe to any group.
    All players should set their target audio group to X before transmitting to be able to talk to "the first player".

    Read more here.
  • Thanks for replying.. can you please show it in the script example I tried but wasn't able to make it work
  • how can I just view the talk to player 1 master client talking button when other player join and not the rest using the example of the demo
  • Hey @JohnTube , I am using the demo example and the players who join after the master client player1 are in the default audio group (0). how do I get them to not subscribe any audio group. And how do I get the target group to be selected at transmission as you say.
    after reading I understand if the player1 is subscribed to all the audio groups(separate for all the different players joining) then it could listen to all individually. I want them to be able to talk to the player1 but not listening to each other voice.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2017
    how do I get them to not subscribe any audio group
    You can't unsubscribe from group 0.
    If you want to unsubscribe from all other groups:
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], null);
    If you want to unsubscribe from all other groups and subscribe to only one:
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], new byte[1] {groupToListenTo});
    To start transmitting to a specific group, use the PhotonVoiceRecorder component attached to the local player's object:
    photonVoiceRecorder.AudioGroup = targetAudioGroup;
    photonVoiceRecorder.Transmit = true;
    For your use case:
    1. The MasterClient or room creator or actor number 1 should subscribe to an audio group X (e.g. 1).
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], new byte[1] {X});
    2. All other players should not subscribe to any group.
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], null);
    3. All players should set their target audio group to X before transmitting to be able to talk to "the first player".
    photonVoiceRecorder.AudioGroup = X;
    photonVoiceRecorder.Transmit = true;
    4. When a player (other than MasterClient) joins just add a button that calls code in 3 to be able to talk to first player.
  • Deadking99
    edited May 2017
    @JohnTube Thanks for the reply man but I followed the steps and it is still not working
  • Deadking99
    Answer ✓
    i am closing this question