question

David Boon avatar image
David Boon asked

PlayFabMultiplayer.CreateAndJoinLobby returned unexpected 'bad request' error 0x%0.8x

Trying to use the CreateAndJoinLobby function with the following code:

PlayFabMultiplayer.CreateAndJoinLobby(new PlayFabAuthenticationContext()
            {
                //PlayFabId = PlayFabLogin.Instance.playFabId,
                ClientSessionTicket = PlayFabLogin.Instance.sessionTicket,
                EntityId = PlayFabLogin.Instance.entityId,
                EntityType = "title_player_account",
                EntityToken = PlayFabLogin.Instance.entityToken,


            }, new LobbyCreateConfiguration()
            {
                MaxMemberCount=20,
                OwnerMigrationPolicy=LobbyOwnerMigrationPolicy.Automatic,
                AccessPolicy=LobbyAccessPolicy.Public,
                SearchProperties=new Dictionary<string, string>()
                {
                    {"GameMode", "Deathmatch" }
                },
                LobbyProperties=new Dictionary<string, string>()
                {
                    { "PlayerColor",ColorUtility.ToHtmlStringRGB(Color.blue) } 
                }


            },new LobbyJoinConfiguration()
            {
                MemberProperties=new Dictionary<string, string>()
                {
                    { "Status","Member" }
                }
            });

But when I try to run the code I get the following error:

the PlayFab service returned unexpected 'bad request' error 0x%0.8x
UnityEngine.Debug:LogError (object)
PlayFab.Multiplayer.PlayFabMultiplayer:LogError (string) (at Assets/PlayFabMultiplayerSDK/Source/Scripts/API/PlayFabMultiplayer.cs:1718)
PlayFab.Multiplayer.PlayFabMultiplayer:LogError (int) (at Assets/PlayFabMultiplayerSDK/Source/Scripts/API/PlayFabMultiplayer.cs:1746)
PlayFab.Multiplayer.PlayFabMultiplayer:Succeeded (int) (at Assets/PlayFabMultiplayerSDK/Source/Scripts/API/PlayFabMultiplayer.cs:1781)
PlayFab.Multiplayer.PlayFabMultiplayer:ProcessLobbyStateChanges () (at Assets/PlayFabMultiplayerSDK/Source/Scripts/API/PlayFabMultiplayer.cs:1475)
PlayFab.Multiplayer.PlayfabMultiplayerEventProcessor:Update () (at Assets/PlayFabMultiplayerSDK/Prefabs/Scripts/PlayfabMultiplayerEventProcessor.cs:24)



Anybody managed to get this lobby sdk to work in Unity? Cause it seems this is somewhat broken to me or I'm just missing what I'm doing wrong

sdks
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

There is a format issue with the SearchProperties. As the documentation mentions, at most 30 key-value pairs may be stored in the SearchProperties, and Keys are of the format string_key1, string_key2 ... string_key30 for string values, or number_key1, number_key2, ... number_key30 for numeric values. For more info, you can refer to Create searchable lobbies - PlayFab | Microsoft Docs. For your case, it should be something like below.

SearchProperties = new Dictionary<string, string>()
{
  {"string_key1", "Deathmatch" }
}
10 |1200

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

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.