Page cover image

Leaderboard UI List

Displaying leaderboard results with zero code

Like what your seeing?

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

The Leaderboard UI List is a simple tool that can be used to display LeaderboardEntry records. The Leaderboard UI List can be used in conjunction with the Leaderboard Manager to display Leaderboards in your UI with a zero code setup as is demonstrated in the Leaderboard Sample Scene.

Namespace

using HeathenEngineering.SteamworksIntegration.UI;

Definition

public class LeaderboardUIList : MonoBehaviour

Events

Enabled

public UnityEvent Enabled;

This is called when the list is enabled and can be useful when you want to refresh a query when enabling (showing) the UI element.

Fields and Attributes

Collection

public Transform collection;

This will be the parent of any records instantiated by the tool. Most often you would set this to be the Content GameObject of a ScrollRect or similar.

Template

public GameObject template;

This is the "template" that will instantiated for each record the list displays. This template should implement a component that inherits from ILeaderboardEntryDisplay. You can either create your own UI Control script and implement the ILeaderboardEntryDisplay interface or you can use the Leaderboard Entry UI Record we provide which has a basic implementation already done.

Methods

Display

public void Display(LeaderboardEntry[] entries)

Calling this method will cause the Leaderboard UI List to clear any currently displayed records and to instantiate the "Template" for each entry passed in. It will attempt to get the ILeaderboardEntryDisplay component on the Template and set it's Entry field.

You can connect this method to the Leaderboard Manager's Query Completed event to automatically display the results of any query ran on the manager. Doing this will give you a "code free" solution for displaying leaderboard entries.

Last updated