Search code examples
c#unity-game-enginegame-centergame-center-leaderboard

Understanding the "daily" and "weekly" scopes in Unity.Social & Apple GameCenter Leaderboards


Unity's Social.TimeScope documentation says:

TimeScope.Today: Only return scores from today https://docs.unity3d.com/352/Documentation/ScriptReference/TimeScope.Today.html

However, Apple's native Swift documentation says:

case today: Each player is restricted to scores recorded in the past 24 hours. https://developer.apple.com/documentation/gamekit/gkleaderboardtimescope

So, when using Unity.Social.TimeScope to fetch "daily" scores from Apple's GameCenter, which of the following are returned:

  1. Scores from today's date (And if so, in which timezone?).
  2. Scores from the past 24 hours, regardless of dates.

The same goes for the "weekly" time scopes: what does "the last week" mean here?

  1. In the scope of the "current" week, i.e. since Sunday?
  2. In the scope of the last 168 hours (7*24), regardless of the current day?

Solution

  • So I ran a little "expirement" using TimeScope. Today for LoadScoresand figured it out myself:

    • I posted a highscore at 17:00.
    • The next day I posted a lower score at 10:00, and still saw the higher score returned when I used LoadScores.
    • I posted the lower score again at 18:00, which was more than 24 hours after the higher score was posted, and this time the lower score was the one that was returned by LoadScores.

    Conclusion: Social.TimeScope.Daily == Scores from the past 24 hours, regardless of dates.

    I am assuming the same logic goes for Weekly: hours instead of dates.