I'm having trouble with lobby creation using the Multiplayer SDK for Unity. I'm following this quickstart guide. I've created a new scene in Unity. I've added the PlayfabMultiplayerEventProcessor to my scene. I've added a GameObject with the following script attached, which should create and join a lobby:
using PlayFab; using PlayFab.ClientModels; using PlayFab.Multiplayer; using UnityEngine; public class PfMpTest : MonoBehaviour { void Start() { var request = new LoginWithCustomIDRequest { CustomId = Random.value.ToString(), CreateAccount = true, }; PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure); } private void OnLoginSuccess(LoginResult result) { var entityKey = new PFEntityKey(result.EntityToken.Entity.Id, result.EntityToken.Entity.Type); PlayFabMultiplayer.SetEntityToken(entityKey, result.EntityToken.EntityToken); PlayFabMultiplayer.OnLobbyCreateAndJoinCompleted += OnLobbyCreateAndJoinCompleted; PlayFabMultiplayer.OnLobbyDisconnected += OnLobbyDisconnected; var createConfig = new LobbyCreateConfiguration() { MaxMemberCount = 10, OwnerMigrationPolicy = LobbyOwnerMigrationPolicy.Automatic, AccessPolicy = LobbyAccessPolicy.Public }; var joinConfig = new LobbyJoinConfiguration(); PlayFabMultiplayer.CreateAndJoinLobby(entityKey, createConfig, joinConfig); } private void OnLoginFailure(PlayFabError error) { Debug.Log(error.ErrorMessage); } private void OnLobbyCreateAndJoinCompleted(Lobby lobby, int result) { Debug.Log("Success!"); } private void OnLobbyDisconnected(Lobby lobby) { Debug.Log("Disconnected from lobby!"); } }
I've also changed the log level to verbose in the PlayFabMultiplayer.Initialze method.
When I hit Play, I get the following errors:
Most notably, it says my lobby was disconnected due no local members. Given that I've called CreateAndJoinLobby, I'd expect that I would be a local member.
How can I fix this so that I can successfully create and join a lobby using the PlayFab Multiplayer Unity SDK?