03-28-2018 08:09 AM
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.