Leaderboard: 404 Leaderboard config could not be found

Hello there !
been trying to implement Unity Leaderboard in my project ( unity v. 2022.3.28f1 ), but keep failing whenever i call the AddPlayerScoreAsync function.

i do authenticate the player via SignInAnonymouslyAsync function and everything works fine ( i checked the user login in my dashboard and ids matched ).

here’s the code:

public class OnlineManager : MonoBehaviour
{


public string leaderboardId = "tlo_1_1";    
 public static OnlineManager Instance;



 private async void Awake()
 {
     var options = new InitializationOptions();

     options.SetEnvironmentName("production");

     await UnityServices.InitializeAsync(options);

     await signiIn();

     if (Instance != null)
     {
         Destroy(gameObject);
         return;
     }

     Instance = this;

     DontDestroyOnLoad(gameObject);
  }

private async Task signiIn()
{
    AuthenticationService.Instance.SignedIn += OnSignedIn;
    AuthenticationService.Instance.SignInFailed += OnSignInFailed;

    Debug.Log("Signing in...");

    await AuthenticationService.Instance.SignInAnonymouslyAsync();
}

private void OnSignedIn()
{
    Debug.Log($"Signed in as: {AuthenticationService.Instance.PlayerId}");
}

private void OnSignInFailed(RequestFailedException exception)
{
    Debug.Log($"Sign in failed with exception: {exception}");
}

public async void SubmitScoreAsync()
{
    try
    {

        var scoreResponse = await LeaderboardsService.Instance.AddPlayerScoreAsync(leaderboardId, 100/*score*/ );
        //messageText.text = "Score submitted!";
        Debug.Log("Score submitted!"+ scoreResponse);
    }
    catch (Exception e)
    {
        //messageText.text = $"Failed to submit score: {e}";
        Debug.Log($"Failed to submit score: {e}");
        throw;
    }
}

so…

  • the user gets authenticated.
  • the project-id is correct ( i doublechecked this comparing the id i find on the dashboard and the id i find in edit → project settings → Services )
  • the environment name is correct ( i also created a new environment, named it “dev”, created another leaderboard in it and “called” it via InitializationOptions passed in UnityServices.InitializeAsync function, still nothing changed )
  • the leaderboard id is correct

here’s the error output in console:

HttpException1: (404) HTTP/1.1 404 Not Found Unity.Services.Leaderboards.Internal.Http.ResponseHandler.HandleAsyncResponse (Unity.Services.Leaderboards.Internal.Http.HttpClientResponse response, System.Collections.Generic.Dictionary2[TKey,TValue] statusCodeToTypeMap) (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/Http/ResponseHandler.cs:112)
Unity.Services.Leaderboards.Internal.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Leaderboards.Internal.Http.HttpClientResponse response, System.Collections.Generic.Dictionary2[TKey,TValue] statusCodeToTypeMap) (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/Http/ResponseHandler.cs:216) Unity.Services.Leaderboards.Internal.Apis.Leaderboards.InternalLeaderboardsApiClient.AddLeaderboardPlayerScoreAsync (Unity.Services.Leaderboards.Internal.Leaderboards.AddLeaderboardPlayerScoreRequest request, Unity.Services.Leaderboards.Internal.Configuration operationConfiguration) (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/Apis/InternalLeaderboardsApi.cs:204) Unity.Services.Leaderboards.Internal.LeaderboardsServiceInternal+<>c__DisplayClass3_0.<AddPlayerScoreAsync>g__AddPlayerScoreAsyncInternal|0 () (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/LeaderboardsServiceInternal.cs:38) Unity.Services.Leaderboards.Internal.LeaderboardsServiceInternal.RunWithErrorHandling (System.Func1[TResult] method) (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/LeaderboardsServiceInternal.cs:213)
Rethrow as LeaderboardsException: Leaderboard config could not be found
Unity.Services.Leaderboards.Internal.LeaderboardsServiceInternal.RunWithErrorHandling (System.Func`1[TResult] method) (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/LeaderboardsServiceInternal.cs:221)
Unity.Services.Leaderboards.Internal.LeaderboardsServiceInternal.AddPlayerScoreAsync (System.String leaderboardId, System.Double score, Unity.Services.Leaderboards.AddPlayerScoreOptions options) (at ./Library/PackageCache/com.unity.services.leaderboards@2.1.0/Runtime/com.unity.services.leaderboards.internal/LeaderboardsServiceInternal.cs:42)
OnlineManager.SubmitScoreAsync () (at Assets/Scripts/OnlineManager.cs:102)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) (at :0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <55fbbbd17b724c15b6abe8c1a3e3289c>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <55fbbbd17b724c15b6abe8c1a3e3289c>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <55fbbbd17b724c15b6abe8c1a3e3289c>:0)

thank u so much !

Make sure you are on the latest patch release (.45f1) and also check the services packages for updates and if there are any, install them.

This seems to indicate that the service endpoint wasn’t found, or perhaps the leaderboard itself. The former is the reason why I suggest updating the packages at least because the endpoint may have changed.

This seems to indicate that the requested data was not found. You should log what you are requesting and double-check that with the cloud dashboard again.

I see you try/catch here but you don’t handle the error, you just throw it again. All the other service call exceptions are not try/catch enclosed at all however.

You can’t leave it like that for production code. You absolutely HAVE to try/catch each and every service call, no exception (literally)! Any of them can fail and you need to handle each of them possibly failing and find a way for the app to gracefully handle each failure.

1 Like

Ty so much for such an exhaustive message, I’ll try everything you suggested and will let you know.
I know my code is still dirty as hell, but this was my first attempt to implement this stuff.

Thank u so much