How to get FUniqueNetId from TSharedPtr(FUniqueNetId)?

Hey everyone!

Using parenthesis instead of less than or greater than symbols because of the HTML formatting.

Working on a steam leaderboards implementation for my simple VR arcade game.

However, writeleaderboards() requires an FUniqueNetId while GetUniquePlayerId() returns a TSharedPtr(FUniqueNetId)

How can I get a straight up FUniqueNetId from this?

I tried using GetUniquePlayerId().Get() but that returns an FUniqueNetId* which also doesn’t work.

For reference:

2 Likes

After you have verified the shared pointer is valid (call the IsValid() method on it), you can dereference the pointer by using an asterisk.

if (pid.IsValid())
{
    ion->GetLeaderboardsInterface()->WriteLeaderboards(SessionName, *pid, WriteObject);
}

You’ll also want to ensure your leaderboards’ interface is also valid.

Perfect! This worked! Thank you so much!

1 hour going through the documentation and found nothing, thank you great sir :v