Unity.Services.Lobbies.LobbyServiceException: player is already a member of the lobby —> Unity.Services.Lobbies.Http.HttpException`1[Unity.Services.Lobbies.Models.ErrorStatus]: (409) HTTP/1.1 409 Conflict
I’m new to UGS and been stuck here for a few days.
Here’s my code for authenticate:
private static async Task Authenticate()
{
var options = new InitializationOptions();
options.SetProfile("Player" + Random.Range(0,1000));
await UnityServices.InitializeAsync(options);
await AuthenticationService.Instance.SignInAnonymouslyAsync();
Debug.Log(AuthenticationService.Instance.PlayerId);
}
Here’s my code for creating lobby:
try
{
var lobbyOptions = new CreateLobbyOptions
{
IsPrivate = true,
Player = GetPlayer()
};
Debug.Log("player " + lobbyOptions.Player.Id);
Lobby hostLobby = await LobbyService.Instance.CreateLobbyAsync("lobby", 4, lobbyOptions);
lobbyMenuScript.Initialized_Host(hostLobby);
PrintPlayers(hostLobby);
}
catch (LobbyServiceException e)
{
Debug.Log(e);
}
Here’s my code for joining lobby:
try
{
string lobbyCode = joinLobbyInp.text;
var lobbyOptions = new JoinLobbyByCodeOptions()
{
Player = GetPlayer()
};
Debug.Log("player " + lobbyOptions.Player.Id);
SetMenuUIsActive(false);
Lobby joinedLobby = await Lobbies.Instance.JoinLobbyByCodeAsync(lobbyCode, lobbyOptions);
lobbyMenuScript.Initialized_Joined(joinedLobby);
}
catch (LobbyServiceException e)
{
Debug.Log(e);
SetMenuUIsActive(true);
}
Here’s GetPlayer
private Player GetPlayer()
{
var player = new Player(AuthenticationService.Instance.PlayerId, data: new Dictionary<string, PlayerDataObject>
{
{
"playername", new PlayerDataObject(PlayerDataObject.VisibilityOptions.Member, playerNameInp.text)
}
});
return player;
}
Previously, I’ve been using Parrelsync with setting profiles to it’s clone arguments. The error still happens.
I’ve built it and ran on the same PC, The error still happens.
I’ve built it and ran on another PC, The error still happens.
Now I’m using Multiplayer Play Mode and it still happens.
Can somebody explain what “player” is in the error because I’ve checked AuthenticationService.Instance.PlayerId and they’re not the same when I’m running a virtual instance in Multiplayer Play Mode.