Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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