question

bkiefer1992 avatar image
bkiefer1992 asked

Multiplayer SDK Unity Lobby Error

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?

unity3dmultiplayer
pfmperror.jpg (37.4 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Do you have access to the support ticket? If you have, please follow this document to submit a support ticket: SUPPORT TICKET SUBMISSION.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bkiefer1992 avatar image bkiefer1992 commented ·

Thanks for getting back to me Gosen,

Unfortunately, I can't use this API with Unity WebGL anyway.

0 Likes 0 ·
bkiefer1992 avatar image bkiefer1992 commented ·

I'll just accept this as the answer, since a fix is no longer required.

Thanks for your time, Gosen.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.