Search Unity

Question Adding non positional and positional to the same channel

Discussion in 'Vivox (Voice & Text Chat)' started by Chen5464, Sep 13, 2022.

  1. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    Hello :), hope ill be able to get any assist.
    Right now in my project i have gotten the positional (3D) to work.
    But im allso trying to make to added the non positional option to one player to be able to talk to all other players without them to talk back (like one sided walkie talkie kind of thing.) so they can hear him only.
    When I try to do so, my 3D audio replaced for 2D , and ofcourse the one sided not working.
    any way that i can do it? (to added 2D input to 1 player while other have only output?)
    Thanks
     
  2. emilyryan

    emilyryan

    Unity Technologies

    Joined:
    Nov 22, 2019
    Posts:
    129
    Hello!

    You should be able to use multi-channel functionality to get this to work!

    If you follow these steps, I believe this would follow along with your needs:

    Let's say April and Leo are in a 3D channel, and you would like Donnie to be able to speak to them through the one way 2D walkie talkie channel.

    Step 1: Have April and Leo join the 3D channel, and make sure they transmit to this channel.
    • If using Vivox with the Unity Engine or Unreal Engine:
      • Set 3rd parameter in BeginConnect to true when joining the channel
    • If using Vivox with any other engines (Core):
      • Call the vx_req_sessiongroup_set_tx_session request and assign it the 3D channel. To learn more read the following documentation.
    Step 2: Have April and Leo join the 2D channel, but have them join without transmitting. To do so, follow the code below:
    • If using Vivox with the Unity Engine or Unreal Engine:
      • Set 3rd parameter in BeginConnect to false when joining the channel
    • If using Vivox with any other engines (Core):
    Step 3a: (Optional) If you would like Donnie to also be able to speak and hear in the 3D channel as well, have him join that channel, but ensure you set his transmission to all. This will allow him to speak into the 2D and 3D channels simultaneously. To do so, logging Donnie intro Vivox services and joining him to the 3D channel, follow the code below:
    • If using Vivox with the Unity Engine:
    • If using Vivox with the Unreal Engine:
    • If using Vivox with any other engines (Core):
    Step 3b: When joining the Donnie to the 3D channel, ensure he joins without changing his transmission settings. To do so, follow the code below:
    • If using Vivox with the Unity Engine or Unreal Engine:
      • Set 3rd parameter in BeginConnect to false when joining the channel
    • If using Vivox with any other engines (Core):
    Step 4: Have Donnie join the 2D channel, but have him join without changing his transmission settings. To do so, follow the code below:
    • If using Vivox with the Unity Engine or Unreal Engine:
      • Set 3rd parameter in BeginConnect to false when joining the channel
    • If using Vivox with any other engines (Core):
    By completely these steps, Donnie will be able to talk into the 2D channel, and April and Leo will be able to hear him. However, Donnie will not hear them speak back in the 2D Channel. April and Leo will also be able to speak to each other as normal in the 3D channel.

    Please let me know if you have any additional questions or if this method does not work for you. Thanks for your time!
     
    Last edited: Sep 28, 2022
    Chen5464 likes this.
  3. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    Thnx for replaying to me!
    I changed a bit my methods so it will fit better with your suggestion .
    But when im trying to log in with "Donnie" its gives me the follwing :

    InvalidOperationException: ChannelSession: Both AudioState and Text State must be disconnected
    VivoxUnity.Private.ChannelSession.BeginConnect (System.Boolean connectAudio, System.Boolean connectText, System.Boolean switchTransmission, System.String accessToken, System.AsyncCallback callback)

    Worth mention :
    Everyplayer is logging as equal to same channels, only 'Donnie' later gets new rule so he can then only speaks to all.
    when im trying to give 'Donnie' that rule this error showed up.

    ** plus the 2D is still active even tho I did as u mention. like it overriden the 3d voice.
    and even if im not logging into the 2D server its still act as 2D, not sure why.
     
    Last edited: Sep 15, 2022
  4. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
     
  5. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    *little update*
    Not sure if what im doing is in the right way, but now if im logging as a 3d first the 3d is working, the 2d not and if I connect with the 2d first nothing is working.
     
  6. UnityKip

    UnityKip

    Unity Technologies

    Joined:
    Nov 15, 2021
    Posts:
    36
    Hi @Chen5464,

    I have two recommendations for you here.
    1. When joining a positional and non-positional channel simultaneously, you should always join the positional channel first. As seen in our documentation here.
    2. Be sure that you are setting your TransmissionMode to All when logging in AND ensuring switchTransmission is false when connecting to the channels.
    Let us know if you continue to see issues or if this works for you!

    -Kip
     
  7. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    should the TransmissionMode to All need to be to all players? and before or after connection. because sometimes it worked after and sometimes not
     
  8. emilyryan

    emilyryan

    Unity Technologies

    Joined:
    Nov 22, 2019
    Posts:
    129
    Hello! You should just need to set TransmissionMode to All on Donnie. April and Leo should just transmit to the 3D channel.

    Feel free to post a copy of your code and we'd be happy to review it!

    Also I have edited my original post above to include the recommendation above Kip found. That was a mistake on my part you should always join the 3D channel first when using Vivox. If you'd like to follow the new steps above you may have more luck! Sorry again for the confusion on my part!
     
  9. Chen5464

    Chen5464

    Joined:
    Jan 14, 2018
    Posts:
    15
    Nop. its still not working. its making all my clients into 2D and not just " Donnie"
     
    Last edited: Oct 14, 2022
  10. Johny_Boy

    Johny_Boy

    Joined:
    Jun 6, 2017
    Posts:
    31
    J1,J2,J3 are in the game on a 3D channel
    J3 dies, J3 can no longer speak but can hear J1, J2 regardless of the position, therefore in a 2D channel, but this does not seem possible
    Since if J1,J2,J3 are on 3D and 2D channel at the same time, then the 3D channel is of no use
    and I see that this solution so that once J3 is dead he can hear J1, J2?
     
  11. Johny_Boy

    Johny_Boy

    Joined:
    Jun 6, 2017
    Posts:
    31
    Is there anything to prevent a player from speaking in a specific channel?
    player joined channel 1 and channel 2
    player speaks in both channels
    but channel 2 volume is zero