Hi there,
I’m looking into using Unity Leaderboards for a cross-platform project. Ideally, I’d like to give players the option of looking at a leaderboard of just their friends as defined by the authentication platform they’re using (e.g. Steam, PSN), rather than making them curate a new set of friends for the Unity platform.
This seems like a fairly obvious thing to do but I’m struggling to see how to implement it. Has anyone attempted something like that? I know I can query a leaderboard given a list of player IDs with GetScoresByPlayerIdsAsync, but I’d need to be able to map the player IDs from Steam’s friend list to Unity player IDs.
Any pointers would be much appreciated!
Thanks.
Exactly, that’s what you need to do.
If a user is authenticated via Unity’s authentication service and the respective Steam (or Epic etc) implementation, then you know both Steam ID and Unity ID. When submitting a leaderboard score, you’ll use the Unity ID but you can add the Steam ID as metadata. Then fetch the entire leaderboard, and filter it by Steam IDs locally.
This won’t scale indefinitely though. At scale you’ll likely want to move that fetch and filter process to Cloud Code.
Or I imagine it might be easiest to also integrate Steam (etc) Leaderboards and simply post the scores to both cloud services. If a Steam user wants to filter by friends, you’d redirect this to the Steam leaderboard. But this then has a fragmentation problem, and possibly the leaderboards (filtered views) being not identical with the unfiltered version (ie submit score to multiple leaderboards may have failed only for some ie service downtime or similar).