question

Jason Schumacher avatar image
Jason Schumacher asked

How do I view leaderboard from website?

I know this has been asked here before, but my understanding of code is pretty rudimentary.

I have created a game in unity that will export scores to a leaderboard in PlayFab. Can someone give me an example of the code I would need to use to allow anyone (not logged in) to view the leaderboard?

I have been successful with creating the game that can login to PlayFab with Unity, and I can actually play the game on my website, but I am having trouble linking my game score to the leaderboard, and the leaderboard to the website.

I am using Wordpress if that matters.


Thanks in advance.

Leaderboards and Statistics
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

·
Seth Du avatar image
Seth Du answered

>> linking my game score to the leaderboard

Actually, Player Statistics is linked with leaderboard in PlayFab, which means if a player add a statistic entry, a leaderboard entry will be created automatically. For more information, please refer to https://docs.microsoft.com/en-us/gaming/playfab/features/data/playerdata/using-player-statistics

>>the leaderboard to the website

There are two ways to get a leaderboard using PlayFab API.

  1. Client API GetLeaderboard: client API means you have to login in and the best practice here is anonymous silent login for your website while you should not worry too much about the account quantity limitation, and please refer to this thread: https://community.playfab.com/questions/24780/should-i-clean-up-anonymous-login-profiles.html.
  2. Server API GetLeaderboard: to call a server API, you need to input a secret key in the http header, which means you should concern about safety issue. You may need to execute it at the backend and should not expose it to the public, then sending the result back to the front end.
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.