Skip to content

Releases: winnitron/WinnitronHighScoreUnity

Winnitron High Score client for Unity v1.0

11 Jan 03:23

Choose a tag to compare

Winnitron High Score Unity Client

Usage

  • Attach a Scoreboard component to a GameObject.
  • Set its API Key and Secret. You can get these values from your game's page on The Winnitron Network.

Sending a high score

HighScore score = new HighScore("Jim", 1000);
scoreboard.Send(score, SuccessHandler);

public object SuccessHandler(object created) {
  // created is an instance of HighScore
  // The world is your oyster.
}

Fetching the existing high score list

// top five scores on the Winnitron being played RIGHT NOW
scoreboard.Get(5, Scoreboard.THIS_WINNITRON, SuccessHandler);

// top ten scores across the entire Winnitron Network
scoreboard.Get(10, Scoreboard.ALL_WINNITRONS, SuccessHandler);

// top twenty scores on the Winnitron 1000
scoreboard.Get(20, "winnitron-1000", SuccessHandler);

public object SuccessHandler(object results) {
  HighScore[] scoreList = (HighScore[]) results;
  // ...
}

Error Handling

If something goes awry - for example, the Winnitron your game is running on loses its network connection, or if the data you send is incomplete/invalid, the above methods will throw a Winnitron.NetworkException.

Test Sandbox

Fetching high scores in test mode will only return scores that were also created in test mode.