cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble uploading and downloading scores with leaderboards?

Avengar
Honored Guest
Hello there,

I don't know if my previous posts has been deleted or haven't showed up in first place but anyway I have big problem with leaderboards on GEAR VR.

I'm using exactly same code on rift and it works perfectly fine. But from begining:

My engine is Unreal Engine 4.18  with according SDK version. I'm passing entilement check without any problem.

My function for uploading scores(included below) always returns true. But it seems that scores never reach leaderboard due to this error poping in logs when i'm trying to download scores:

Empty Leaderboard Read in ReadLeaderboardsAroundViewer()

which means leaderboard that i'm trying to access has exactly 0 rows

This is my AddScores function:

bool UOculusFunctions::AddScoreToLeaderboard(FName LeaderboardName, int32 Score)
{
if (IOnlineSubsystem* const OnlineSub = IOnlineSubsystem::IsLoaded() ? IOnlineSubsystem::Get() : nullptr)
{
auto IdentityInterface = OnlineSub->GetIdentityInterface();
if (IdentityInterface.IsValid())
{
auto LoggedInPlayerId = IdentityInterface->GetUniquePlayerId(0);
if (LoggedInPlayerId.IsValid())
{
auto Leaderboard = OnlineSub->GetLeaderboardsInterface();
if (Leaderboard.IsValid())
{
FOnlineLeaderboardWrite WriteObject;
WriteObject.LeaderboardNames.Add(LeaderboardName);
WriteObject.RatedStat = GAME_STATNAME;
WriteObject.DisplayFormat = ELeaderboardFormat::Number;
WriteObject.SortMethod = ELeaderboardSort::Descending;
WriteObject.UpdateMethod = ELeaderboardUpdateMethod::KeepBest;
WriteObject.SetIntStat(GAME_STATNAME, Score);
bool bResult = Leaderboard->WriteLeaderboards(FName(), *LoggedInPlayerId, WriteObject);
UE_LOG_ONLINE(Warning, TEXT("OCULUS: Wrote score to %s %d, Result: %s"),
*LeaderboardName.ToString(),
Score,
bResult ? TEXT("Success") : TEXT("Failure")
);
return bResult;
}
else
{
UE_LOG_ONLINE(Warning, TEXT("OCULUS: Leaderboard Invalid."));
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("OCULUS: Logged in Player Invalid."));
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("OCULUS: Identity interface Invalid."));
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Failed to get online subsystem."));
}
return false;
}


If there is any information needed in addition to this just let me know. 
ALSO let me know if i posted it wrongly becouse i have no clue where my other post gone.

0 REPLIES 0