Search Unity

Question Best way to find host IP in local Lobby

Discussion in 'Netcode for GameObjects' started by tutyses123, Feb 16, 2023.

  1. tutyses123

    tutyses123

    Joined:
    Jul 20, 2019
    Posts:
    2
    Hello everyone
    I m trying to develop a simple multiplayer mobile phone game that works using the local network (no internet, just the WiFi). I m working with the lobby and i was wondering if there is an easy way to implement a method for the player to find the match automatically. Right now the player have to write down the Host IP adress. I tried to make a IP sweep to find the server ip automatically but i failed horribly and i did not find any tutorial about this topic. I read there was a component called NetworkDiscovery that was meant for this purpose but it is deprecated. Any idea of which would be the easier way to implement or any tutorial that could help me will be REALLY appreciated.
    Thank you
     
  2. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    Can't you query for lobbies using the lobby service?
    QueryResponse lobbies = await Lobbies.Instance.QueryLobbiesAsync(options);
     
  3. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    For reference, it's this one. Maybe it's a good starting point?