How to send Playing Time to Google Leaderboard?
How to send Playing Time to Google Leaderboard? Time or Datetime
Comment
What do you want to know? How to accumulate it? What the call in google play games is? Be more specific please.
Best Answer
Answer by MtFordStudios · Feb 17, 2017 at 08:24 AM
Hi @Ancy. I recently needed to do the same. Here is my result which works. Note: Make sure to report the time in milliseconds (So for me, I had to multiply my total time in seconds by 1000).
private void PostTimeOnline() {
if (PlayGamesPlatform.Instance.IsAuthenticated()) {
// report total play time
Social.ReportScore((long) (GameInfo.TimeTotalPlay * 1000), GPGSIds.leaderboard_playtime, (bool success) => {
if (!success) {
Debug.LogError("Error posting to leaderboard_playtime");
}
});
}
}
Sorry, I forgot to mention. If you haven't already, make sure on the Developer Console to set the Score formatting of the leaderboard to Time.