question

bitemeads avatar image
bitemeads asked

leaderboards not working on android build ,but works in editor

Hey there, for our game we use leaderboards and have tested this in unity editor, and always worked,but whenever we build it for android the leaderboards never work

any idea where the problem could lie?

thanks

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.

brendan avatar image
brendan answered

What API call are you making, and what is the response? I can guarantee that leaderboards do work on all platforms, as it's the same API call regardless of platform. If they were failing, we'd be hearing about it from roughly 3K developers right now. :)

4 comments
10 |1200

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

bitemeads avatar image bitemeads commented ·

i use the "GetLeaderboardAroundPlayerRequest" and in unity the response is normal and can be used to fill ui or set other data , the same project build for android makes it never fill the ui.

i know playfab is cross platform and realize the problem is with me , just hearing if you had an idea where the problem is

0 Likes 0 ·
brendan avatar image brendan bitemeads commented ·

We specifically don't interfere in the presentation layer of the game in any way, so it's not really clear why you're not seeing it displayed. Can you try debugging into your code and check the values coming back from PlayFab?

0 Likes 0 ·
bitemeads avatar image bitemeads brendan commented ·

ive logged the result and on android neither success or error gets called , while on pc ive used the same way of debuggin and there it returns the last playfab id on success and the errormessage on error... so there is certainty that its not a playfab issue since it does not get called it seems , do you have any thoughts what i might be doing wrong though?

im sure the method gets called,this got logged

0 Likes 0 ·
Show more comments
bitemeads avatar image
bitemeads answered
    public void getLeaderBoard() {
        GetLeaderboardRequest levelRequest = new GetLeaderboardRequest()
        {
            StatisticName = "score",
            StartPosition = 0,
            MaxResultsCount = 50
        };


        PlayFabClientAPI.GetLeaderboard(levelRequest,
            (result) => //On success
            {
                Debug.Log("leaderboard returned with: " + result.Leaderboard);
                List<PlayerLeaderboardEntry> leaderboardData =new List<PlayerLeaderboardEntry>() ;
                foreach (PlayerLeaderboardEntry p in result.Leaderboard)
                {
                    if (!p.PlayFabId.Equals(playfabid))
                    {
                        leaderboardData.Add(p);
                    }
                }
                watchtowerManager.setLeaderBoardArray(leaderboardData);
               
               
            },
            (result) => //On fail
            {
                Debug.LogError("stats couldn't be retrieved");
                
            });
    }

this is the method i call to get the leaderboards and i add them in a list.

what is postman? and what do u mean with a network capture? send the incoming and outgoing requests from unity? or something else?

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.

brendan avatar image brendan commented ·

A network capture would be done using a tool like Wireshark (https://wiki.wireshark.org/SSL). But let's start more simply. Please put breakpoints into this, and let us know specifically what the values are for the parameters you're passing into the call, and the details of the response you get back.

Then, try the same call in Postman (https://api.playfab.com/docs/tutorials/execute-playfab-api-via-postman), and let us know the same - details of call and response.

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.