Removing a player from the lobby

I’m designing a simple multiplayer game with Normcore, and I was wondering whether this is an adequate method of removing players from the lobby?

I’ve tested it a few times now, and occasionally the lobby states that the player is still in the lobby, even after their game instance has been closed.

    // removes the local player from the lobby
    private async void OnDestroy()
    {

        string identity = AuthenticationService.Instance.PlayerId;
        await LobbyService.Instance.RemovePlayerAsync(code, identity);

    }

That should be good enough. Are you not seeing any unhandled errors in the log when that occurs?

When you say “the lobby states that the player is still in the lobby” are you referring to a different client that’s in the same lobby?