#Game Center Essential Kit Load Leaderboard Bug

1 messages · Page 1 of 1 (latest)

pure steeple
#

I am trying to load the player's score on playercentered spot on a classic leaderboard. If there isn't any data to load for the weekly score, the essential kit throws a null reference exception causing my other buttons to break. My game is live and on the front page of the words category so I am hoping to get a fix soon. Xcode debugger below:

[VoxelBusters.CoreLibrary.EssentialKit] System.NullReferenceException: Object reference not set to an instance of an object.
at VoxelBusters.EssentialKit.GameServicesCore.iOS.Leaderboard+<>c__DisplayClass18_0.<LoadPlayerCenteredScoresInternal>b__0 (VoxelBusters.EssentialKit.IScore[] scores, VoxelBusters.CoreLibrary.Error error) [0x00000] in <00000000000000000000000000000000>:0
at VoxelBusters.EssentialKit.GameServicesCore.iOS.Leaderboard.HandleLoadScoresNativeCallback (VoxelBusters.CoreLibrary.NativePlugins.NativeArray& nativeArray, System.String error, System.IntPtr tagPtr) [0x00000] in <00000000000000000000000000000000>:0
VoxelBusters.EssentialKit.GameServicesCore.iOS.Leaderboard:HandleLoadScoresNativeCallback(NativeArray&, String, IntPtr)

Please let me know what I can do @weak sentinel . Thanks!

#

Essenitals Kit 2.7.1 but was also happening on 2.6.0 I believe was the version number. Unity 2022.3.10f1

weak sentinel
#

Please share your implementation once?
Also confirm it it's reproducible from our GameServicesDemo scene.

pure steeple
#

It only happens in the builds, not in the editor. It works in the editor. I use the same method for weekly "All" leaderboard as I do for the non working weekly "Player centered" leaderboard. Below is my implementation:

` public void LoadPersonalLeaderboardScores(GameObject leaderboardPrefab, Transform contentParent, string leaderboardId, LeaderboardTimeScope timeScope, ShowLeaderboardsButton.LEADERBOARD_TYPE leaderboardTypeButton)
{
ILeaderboard leaderboard = GameServices.CreateLeaderboard(leaderboardId);
leaderboard.LoadScoresQuerySize = maxLeaderboardQuerySize;
leaderboard.TimeScope = timeScope;

    leaderboard.LoadPlayerCenteredScores((result, error) => {
        if (error == null)
        {
            Debug.Log("Scores loaded : " + result.Scores);
            for (int iter = 0; iter < result.Scores.Length; iter++)
            {
                IScore score = result.Scores[iter];
                LeaderboardEntry entry = Instantiate(leaderboardPrefab, contentParent).GetComponent<LeaderboardEntry>();
                entry.InitializeEntry(score.Rank, score.Player.DisplayName, score.Value);
                //Debug.Log(string.Format("Player {0} Rank : {1} Score : {2}", score.Player.DisplayName, score.Rank, score.Value));
            }
        }
        else
        {
            Debug.LogError("Failed loading top scores with error : " + error.Description);
        }
    });
}`
weak sentinel
#

Is it reproducible with GameServicesDemo scene on device?

pure steeple
#

The demo scene does not provide a functionality (as far as I know) to display a player centered weekly leaderboard. I ran a debug build and got a more detailed error message:

weak sentinel
#

Can you try updating this file in Assets/Plugins/VoxelBusters/EssentialKit/Runtime/iOS/GameServices folder?
May be local player score is null, I mean no scores were submitted by the player who actually request this call. Possible?

pure steeple
#

That’s definitely happening. I don’t have a score for the weekly player centered score. I will give it a try and report back

weak sentinel
#

Great! Please keep me posted!

pure steeple
#

Yes this corrected the issue! Thank you so much. Will this be added to a future update?