I'm trying to use the REST API in Unity to create and find lobbies, but even though I can successfully create a lobby and connect to it as the owner, every call to FindLobbies returns zero results.
The API requests do include the X-EntityToken header, and I don't see any errors, so I'm not sure what I might be doing wrong.
(I'm not currently using the Unity Lobbies SDK for this because that doesn't seem to work on Android.)
I have a public repo here in case more context is useful, but below is the function that attempts to find the lobbies:
public static bool FindLobbies(string search, Action<List<LobbySummary>> onSuccessCallback, Action<string> onErrorCallback ){ if (PlayerEntity.LocalPlayer != null){ OnScreenMessage.SetText("Finding Lobbies..."); var requestProps = new FindLobbiesRequest {}; PlayFabMultiplayerAPI.FindLobbies( requestProps, r => APIOnLobbyFindLobbiesCompleted(r, onSuccessCallback), e => Debug.LogError(e.GenerateErrorReport()) ); return true; } return false; } private static void APIOnLobbyFindLobbiesCompleted( FindLobbiesResult result, Action<List<LobbySummary>> callback ){ ExtDebug.LogJson("APIOnLobbyFindLobbiesCompleted", result); callback?.Invoke(result.Lobbies); }
And this is the function that creates the lobby:
public static void CreateAndJoinLobby( string name, string level, uint maxPlayers, bool isInvisible, bool isPublic, Action<PlayFab.MultiplayerModels.Lobby> successCallback, Action<string> errorCallback ){ OnScreenMessage.SetText($"Creating lobby: {name}..."); PlayFabMultiplayerAPI.CreateLobby( new CreateLobbyRequest { MaxPlayers = maxPlayers, OwnerMigrationPolicy = OwnerMigrationPolicy.Automatic, AccessPolicy = isPublic ? AccessPolicy.Public : AccessPolicy.Private, SearchData = new Dictionary<string, string>{ {LobbyWrapper.LOBBY_NAME_SEARCH_KEY, name}, {LobbyWrapper.LOBBY_LEVEL_SEARCH_KEY, level}, {LobbyWrapper.LOBBY_VISIBILITY_SEARCH_KEY, ( isInvisible ? ((int)LobbyWrapper.LobbyVisibility.Invisible) : ((int)LobbyWrapper.LobbyVisibility.Visible) ).ToString()}, }, LobbyData = new Dictionary<string, string>{ {LobbyWrapper.LOBBY_NAME_KEY, name}, {LobbyWrapper.LOBBY_LEVEL_KEY, level}, {LobbyWrapper.LOBBY_SESSION_KEY, Guid.NewGuid().ToString()}, }, Owner = PlayerEntity.LocalPlayer.entityKey, UseConnections = true, Members = new List<Member>{ new Member { MemberData = new Dictionary<string, string>{ {PlayerEntity.PLAYER_NAME_KEY, PlayerEntity.LocalPlayer.name} }, MemberEntity = PlayerEntity.LocalPlayer.entityKey, } } }, r => _OnLobbyCreated(r, successCallback, errorCallback), e => OnError(e, errorCallback) ); }