Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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