question

alexcsts avatar image
alexcsts asked

How do I get PlayFabId from the list of players in SessionInfo?

I'm using GSDK (PlayFabMultiplayerAgentAPI) OnSessionConfigUpdateEvent to get the list of players currently connected to my server under SessionInfo.InitialPlayers. However, that list contains only strings with entity data "<entity_type>!<titleId>".

Then, how can I get the PlayFabId of the player to access their data if, by the time they are connected, their login is already done (since I'm using PlayFab's own matchmaking solution)? If the client (player) himself must send the server that info, how would he do it?

I've tryed GetUserProfile, but that gives an error on the server because it is not logged in.

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

As Information passed to the game server mentioned, the InitialPlayers is set to the list of members in the match. So InitialPlayers are not the current connected players, it means that those players are matched together and they will receive the detailed server info and are about to connect to the server. But they are not in the server until they connect to the server using the IP address and port. So if you want to get the PlayFabId of the currently connected players, you should pass the PlayFabId as a parameter to the server when the players try to connect to the server. When they connect successfully, you can add the PlayFabId to the array of currently connected players, so you can know how many players are connected to the server, and also get information about the corresponding players. For more details, you can refer to the Unity Mirror sample.

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.