Search Unity

Question How can I access the number of Players joined to Relay

Discussion in 'Relay' started by aliwebconsultant, Feb 5, 2023.

  1. aliwebconsultant

    aliwebconsultant

    Joined:
    Sep 8, 2021
    Posts:
    42
    I am working on the multiplayer game and need to access the current joined number of players joined the relay
     
  2. arnaud_gout

    arnaud_gout

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    26
    Hello aliwebconsultant
    The easiest way to get this information is by using the Relay-Netcode for Gameobjects integration, you can have the documentation here.
    Then you should be able to access to
    NetworkManager.ConnectedClients

    I hope this helps

    Arnaud

    EDIT: if you use Relay directly with Unity transport, you will have to implement this yourself since it's a lower level API