Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Bug GetScoresAsync never exits when service has not been initialized

Discussion in 'Leaderboards' started by Rinusch, Apr 28, 2023.

  1. Rinusch

    Rinusch

    Joined:
    Mar 28, 2022
    Posts:
    8
    Hi,

    A couple of days ago I re-ordered my project and when short-cutting directly into a game-scene for the sake of play-testing, I found that GetScoresAsync() hung.

    Task<LeaderboardScoresPage> GetScores = LeaderboardsService.Instance.GetScoresAsync(leaderboardID, new GetScoresOptions { Limit = maxNumberOfScoresInLeaderboard });

    Somehow, Unity got stuck in this call and never got out without any exception being thrown or whatever.

    It took me a while before I realised that due to the short-cut I took, the 'UnityServices.InitializeAsync()' method never got called. After fixing this, it worked again.

    Is this a correct observation or am I completely overseeing something else maybe?
     
  2. Unity_AndyP

    Unity_AndyP

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    65
    This is most likely to be the case. If you miss initializing the services then you won't be able to authenticate the user, this will prevent you from calling the service which is why you were experiencing the hang.
     
  3. Rinusch

    Rinusch

    Joined:
    Mar 28, 2022
    Posts:
    8
    Thanks. Actually, I not only 'forgot' to initialize the service but also forgot to sign in anonymously before calling GetScoresAsync(). Hence, I didn't stumble upon an error when signing in (because I didn't try signing in).

    But still..the hanging behaviour -even given the circumstances- seems like a valid bug to me. There should always be a way somebody gets noticed something is wrong and the routine shouldn't be busy waiting and never return instead..right?
     
    Unity_AndyP likes this.