You need to create a leaderboard on your dashboard before proceeding. Make sure you set up automatic resets and prizes in the dashboard if needed.
Report a score
Report scores from a user. LevelId is optional and can be any string to distinguish your levels. You do not need to individually create leaderboards for each level! Passing a LevelId acts as a filter.
What is a Level? You can use a LevelId if you want separate leaderboards for separate levels in your game, without having to create multiple leaderboards. Just use the same LevelId to report the score and show the leaderboard.
This is fully optional.
Galaxy_ReportScore(leaderboard_id, score_value, level_id?) //level_id is optional
Show the leaderboard
Configure the leaderboard UI, reset behavior, and more in your dashboard.
The UI doesn't work in the Unity editor! Run on a real device to test.
//Show a combined UI for the default leaderboard full screen
GalaxyClientAPI.Controller.OpenLeaderboard(LeaderboardId: "leaderboard_id");
//Only show scores reported for level "level_id" and include ViewOptions
GalaxyClientAPI.Controller.OpenLeaderboard(
LeaderboardId: "leaderboard_id",
LevelId: "level_id",
Options: ViewOptions
);
//Overlay on the screen
window.galaxy.ShowLeaderboard({
leaderboard_id: 'leaderboard_id'
});
Every Open call accepts an optional ViewOptions parameter that can be used to customize the view. Here's a ViewOptions example with defaults:
new GalaxySDK.GalaxyController.ViewOptions {
Left = 0,
Top = 0,
Right = 0,
Bottom = 0,
HideCloseButton = false,
CloseButtonPosition = 0, //0 for left, 1 for right
OnClose = onClose //Action
}
A player record contains information about their score/rank on a specific leaderboard. If no PlayerId is passed, the current user is returned.