Search Unity

Resolved Callback for player join / get lobby player count

Discussion in 'Lobby' started by bluepilkintonching, Nov 30, 2022.

  1. bluepilkintonching

    bluepilkintonching

    Joined:
    Nov 29, 2019
    Posts:
    30
    Hi there! Is there a callback for when a player joins a lobby? I'm trying to run some code for when the lobby fills up, but I couldn't find anything in the docs about how to do that.

    EDIT: I saw that the docs explained how to poll the Lobby for updates,
    Code (CSharp):
    1. await LobbyService.Instance.GetLobbyAsync("lobbyId");
    Thanks!

    This system seems silly to me, as you would be wasting resources constantly communicating with the Lobby server when it isn't necessary 90% of the time. There isn't any way that the lobby could call an RPC or something, to make this system less wonky?
     
    Last edited: Nov 30, 2022
  2. RobustKnittedTortoise

    RobustKnittedTortoise

    Unity Technologies

    Joined:
    Dec 10, 2018
    Posts:
    16
    There is an event SDK that is in closed beta for lobby right now. It allows you to get events for players added/removed and public player/lobby data updates without having to poll the lobby. Would you be interested in helping test that new feature?
     
  3. bluepilkintonching

    bluepilkintonching

    Joined:
    Nov 29, 2019
    Posts:
    30
    Thanks for getting back to me!
    I've found a workaround that involves getting a callback when someone connects to the relay server instead of getting a callback when someone connects to the lobby (which makes more sense more my specific situation anyway.) I appreciate the offer, but it's not really an issue for me anymore! I'm looking forward to hopefully seeing if this feature comes out though!
    All the best.
     
  4. krishna268

    krishna268

    Joined:
    Mar 1, 2022
    Posts:
    2
    I tried using this piece of code but it says for LobbyEventCallbacks() , with a red sqiggly line that "you are missing a directive". I cant find the directive when I tried to correct it. Can anyone help me here ? I am using version 1.0.3
     
  5. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    488
    krishna268 likes this.
  6. krishna268

    krishna268

    Joined:
    Mar 1, 2022
    Posts:
    2