# Leaderboard UI List

{% hint style="success" %}

#### Like what your seeing?

Support us as a [GitHub Sponsor](https://kb.heathen.group/old-kb/where-to-buy/become-a-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](https://kb.heathen.group/old-kb/where-to-buy/become-a-sponsor) ... become a sponsor today!
{% endhint %}

## &#x20;Introduction

The Leaderboard UI List is a simple tool that can be used to display [LeaderboardEntry ](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/classes/leaderboard-entry)records. The Leaderboard UI List can be used in conjunction with the [Leaderboard Manager](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/components/leaderboard-manager) to display Leaderboards in your UI with a zero code setup as is demonstrated in the [Leaderboard Sample Scene](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/broken-reference).

### Namespace

```csharp
using HeathenEngineering.SteamworksIntegration.UI;
```

### Definition

```csharp
public class LeaderboardUIList : MonoBehaviour
```

## Events

### Enabled

```csharp
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

```csharp
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

```csharp
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](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/programming-tools/ileaderboardentrydisplay). You can either create your own UI Control script and implement the [ILeaderboardEntryDisplay](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/programming-tools/ileaderboardentrydisplay) interface or you can use the [Leaderboard Entry UI Record](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/leaderboard-entry-ui-record) we provide which has a basic implementation already done.

## Methods

### Display

```csharp
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 ](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/programming-tools/ileaderboardentrydisplay)component on the Template and set it's [Entry](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/programming-tools/ileaderboardentrydisplay#entry) field.

You can connect this method to the [Leaderboard Manager's Query Completed](https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/components/leaderboard-manager#evtquerycompleted) 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.
