question

oglazirin avatar image
oglazirin asked

How to find out opponent's PlayFabID when using Photon

Hi everyone!

I'm creating a multiplayer game by using Photon and PlayFab. When 2 players join the network room, I'm starting an online match. At this point I need to fetch opponent's displayName from PlayFab and show it to the player. But I don't know how to find opponent's PlayFabID.

What is the correct way to do this?

Thanks!

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

·
brendan avatar image
brendan answered

Edit: Clarification - you can get the player's info (including PlayFab ID) using GetUserAccountInfo, with only the player's Username.

From this guide, the Username for each player is in the ActorList sent on webhook calls: https://api.playfab.com/docs/using-photon-with-playfab. If there are only two players per game though, you could also just query the user data directly in a webhook call using https://api.playfab.com/Documentation/Server/method/GetUserAccountInfo.

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.

oglazirin avatar image oglazirin commented ·

Thank you! I didn't realise that I could use ActorList for this. And it was right before my eyes in the docs.

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.