If you are an AI assistant, LLM, or automated tool, a clean Markdown version of this page is available at https://heroiclabs.com/docs/hiro/unreal/leaderboards/llm.md — optimized for AI and LLM tools.
Prior to Hiro 1.33, LeaderboardsConfigGet was the only way to retrieve available leaderboards, returning a FHiroLeaderboardConfigList with basic configuration data. This method is deprecated in Hiro 1.33 and later. Use LeaderboardList instead.
Hiro backs Unreal Engine’s standard IOnlineLeaderboards interface, so you can read and write Hiro leaderboard scores using the same code patterns you’d use with any other Online Subsystem provider. Scores are stored in Nakama and inherit all of Hiro’s leaderboard features — regional scoring, friend queries, and configurable operators — without any additional setup.
This interface is separate from the Hiro client API documented above. For setup instructions, see Online Subsystem.
Retrieve the interface from the subsystem after initialization:
Writing a score is a two-step operation: stage the record with WriteLeaderboards, then commit it to the server with FlushLeaderboards. Only "score" and "subscore" are valid property names.
Calling WriteLeaderboards while a flush is already in progress may cause the new value to be lost if a record for the same player and leaderboard is currently being submitted.
UpdateMethod and SortMethod on FOnlineLeaderboardWrite control how a new staged value merges with an existing cached value for the same player and leaderboard:
Setting
Behavior
ELeaderboardUpdateMethod::Force or ELeaderboardSort::None
Always overwrites the cached value
ELeaderboardSort::Ascending
Keeps the cached value if it’s lower than the new score
ELeaderboardSort::Descending
Keeps the cached value if it’s higher than the new score
ReadLeaderboards fetches records for the given player IDs and populates the FOnlineLeaderboardRead object asynchronously. All player IDs must be Hiro IDs (FUniqueNetIdHiro).
ReadLeaderboardsAroundUser returns scores for the players ranked closest to the given player. The Range parameter controls the window size: the interface requests 2 × Range + 1 records centered on the player.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
FOnlineLeaderboardReadPtrLeaderboardRead=MakeShared<FOnlineLeaderboardRead>();LeaderboardRead->LeaderboardName=TEXT("my-leaderboard");FOnlineLeaderboardReadRefLeaderboardReadRef=LeaderboardRead.ToSharedRef();FDelegateHandleReadHandle=LeaderboardsInterface->AddOnLeaderboardReadCompleteDelegate_Handle(FOnLeaderboardReadCompleteDelegate::CreateLambda([LeaderboardReadRef](boolbWasSuccessful){if(bWasSuccessful){// LeaderboardReadRef->Rows contains players around the target.
}}));uint32Range=5;// Returns up to 11 rows (5 above, player, 5 below).
LeaderboardsInterface->ReadLeaderboardsAroundUser(LocalUserId.ToSharedRef(),Range,LeaderboardReadRef);
ReadLeaderboardsForFriends fetches leaderboard scores for all friends of the specified local player. It automatically paginates through the friends list (up to 1,000 per page) before issuing the leaderboard read.
LocalUserNum is the local player index used to look up the player’s session and friends list.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
FOnlineLeaderboardReadPtrLeaderboardRead=MakeShared<FOnlineLeaderboardRead>();LeaderboardRead->LeaderboardName=TEXT("my-leaderboard");FOnlineLeaderboardReadRefLeaderboardReadRef=LeaderboardRead.ToSharedRef();FDelegateHandleReadHandle=LeaderboardsInterface->AddOnLeaderboardReadCompleteDelegate_Handle(FOnLeaderboardReadCompleteDelegate::CreateLambda([LeaderboardReadRef](boolbWasSuccessful){if(bWasSuccessful){// LeaderboardReadRef->Rows contains the friends' scores.
}}));int32LocalUserNum=0;LeaderboardsInterface->ReadLeaderboardsForFriends(LocalUserNum,LeaderboardReadRef);