question

tobias-nerg avatar image
tobias-nerg asked

MaxMemberCount, CurrentMemberCount is 0 in FindLobbies for MultiplayerSDK Unity

When PlayFabMultiplayer.OnLobbyFindLobbiesCompleted fires, all the lobbies in the result always has 0 MaxMemberCount and 0 CurrentMemberCount.


Running the HTTP request with Postman shows the correct numbers (https://{ {TitleId}}.playfabapi.com/Lobby/FindLobbies).

private void PlayFabMultiplayer_OnLobbyFindLobbiesCompleted(IList<LobbySearchResult> searchResults, PFEntityKey searchingEntity, int reason)
		{
			if (LobbyError.SUCCEEDED(reason))
			{
				// Successfully found lobbies


				m_lobbyInfoEntryList.Clear();
				m_lobbyInfoEntryList.LobbyInfoLobbyDictionary.Clear();


				// Iterate through lobby search results
				foreach (LobbySearchResult result in searchResults)
				{
					Debug.Log("Found a lobby!");
					m_lobbyInfoEntryList.AddToList(new LobbyInfoEntry()
					{
						MaxPlayers = result.MaxMemberCount,
						CurrentPlayers = result.CurrentMemberCount,
						LobbyOwner = result.OwnerEntity.Id,
						ConnectionString = result.ConnectionString,
						RoomName = result.SearchProperties["string_key1"]
					});
				}
			}
			else
			{
				// Error finding lobbies
				Debug.Log("Error finding lobbies");
			}


			m_findLobbiesInProgress = false;


			/*if(m_lobbyInfoEntryList.Values.Count != 0)
			{
				m_lobbyInfoEntryList.SelectedLobbyInfoEntry = m_lobbyInfoEntryList.Values.First();
				JoinLobby(m_lobbyInfoEntryList.SelectedLobbyInfoEntry.ConnectionString);
			}*/
		}

Setting a breakpoint with the debugger at lines

MaxPlayers = result.MaxMemberCount,
CurrentPlayers = result.CurrentMemberCount,

shows that result.MaxMemberCount and result.CurrentMemberCount always is 0.

10 |1200

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

JayZuo avatar image
JayZuo answered

Thank you for reporting this issue. This seems to be a Multiplayer Unity SDK issue. We've reported it to our engineering team. Sorry for the inconvenience!

10 |1200

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

Seth Du avatar image
Seth Du answered

To be clear, as long as the request of FindLobbies API is valid and well-formatted, PlayFab won't return a failed callback result, even though the result is not found. Please check your filter again and make sure the OData string is working.

Would you try to test APIs in RESTful testing tools like Postman?

1 comment
10 |1200

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

tobias-nerg avatar image tobias-nerg commented ·

Hey! I think I got confused since there are two API:s to fetch lobbies (https://community.playfab.com/questions/61144/a-couple-of-questions-about-lobbies.html)

Which would mean that the API I'm calling (https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/lobby/unity-multiplayer-api-reference/playfab.multiplayer/playfabmultiplayer/findlobbies)

public void FindLobby()
{
			
	LobbySearchConfiguration config = new LobbySearchConfiguration();
	m_findLobbiesInProgress = true;
	PlayFabMultiplayer.FindLobbies(GetEntityKey(), config);
}

returns 0 by design(?).

https://docs.microsoft.com/en-us/rest/api/playfab/multiplayer/lobby/find-lobbies?view=playfab-rest

is the one clients should call for the full dataset I presume.

Sorry, I'm still trying to make out what API's are meant to be used where, still I think it's odd that PlayFabMultiplayer.FindLobbies returns a result which includes Max and Current players if they are not populated correctly (in which case the data can just be omitted).

As for testing the API with Postman, sadly I have no idea what endpoint is actually used under the hood of PlayFabMultiplayer.FindLobbies

1 Like 1 ·

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.