Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question [NetCode] How to find existing Host with Client ?

Discussion in 'Multiplayer' started by Croustillant, Sep 14, 2022.

  1. Croustillant

    Croustillant

    Joined:
    Dec 14, 2013
    Posts:
    2
    Hello !

    I would like to use a single button to allow a Host to be started and a Client to connect to this Host.

    What I'd like to do precisely:
    - Player A clicks on the button, if there are no Host, he becomes the Host.
    - Player B clicks on the (same) button, if there are no Host, he becomes the Host, if there is a Host (Player A for instance) he connects to this Host as a Client.

    Is there a simple way to achieve that ?

    I'm using Unity 2021.3.9f1 and switching from UNet to NetCode (and I used to use Matchmaking to do this, but it's not available yet for NetCode :( )
     
  2. Croustillant

    Croustillant

    Joined:
    Dec 14, 2013
    Posts:
    2