Open Leaderboard using Apple Unity Plugin GameKit

This may be a bit dumb but I've really been having trouble with understanding the documentation for Apple's Unity Plugins. I wanted to implement Game Center functionality on my game. So far the only line of code I've managed to get working is the authentication, in which I did

async void Start() { await Login(); }

public async Task Login()
{
    if (!GKLocalPlayer.Local.IsAuthenticated)
    {
        var player = await GKLocalPlayer.Authenticate();
        var localPlayer = GKLocalPlayer.Local;
    ]

}

However, I'm at a complete loss as to how to open leaderboards. I followed the documentation given:

void OpenLeaderboard() { var allLeaderboards = await GKLeaderboard.LoadLeaderboards(); var filteredLeaderboards = await GKLeaderboard.LoadLeaderboards("leaderboardIwant1"); }

But it did not work. What did I do wrong? Am I missing a function to get it to work? Why can't Apple write proper documentation to properly implement this in a simple way?

My apologies for my frustration. Up until now I've used another plugin from the Unity Asset Store which is shockingly easy to use, but I decided to attempt to use Apple's system because the plugin I had used deprecated functions and I was afraid the App Store would not approve it. But Apple's own plugins are stunningly opaque and hard to test.

As additional questions (but not the main ones), I'm also completely at a loss how to submit scores or load specific leaderboards and Apple's documentation does nothing to help there either.

Any help or thoughts are appreciated. Thanks.

  1. The game's leaderboard must be launched to access it.
  2. The id often needs to be in an [array] to be recognized.
  3. It is recommended to use try catch to catch error messages.

Below is a part of the code I used.

try
            {
                var gameCenter = GKGameCenterViewController.Init(GKGameCenterViewController.GKGameCenterViewControllerState.Leaderboards);
                await gameCenter.Present();
            }
            catch (GameKitException ex)
            {
                Debug.LogError($"GameKitException while presenting leaderboard: {ex.Message}");
            }
            catch (Exception ex)
            {
                Debug.LogError($"Unexpected error while presenting leaderboard: {ex.Message}");
            }
Open Leaderboard using Apple Unity Plugin GameKit
 
 
Q