Hi guys,
I’m trying to create a time based leaderboard on google play services. I’ve already created a working points leaderboard. The problem I’m having is the script won’t compile for the time based one and I’m thinking there’s no way to use floats for google play services. I know very little about c# so I’m probably missing something elementary. Here’s the script.
using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class zebz_1A : MonoBehaviour{
//time leaderboards strings
private string A1ft = "sdfhsgjjsfygjsjk";
void Start(){
PlayGamesPlatform.Activate();
}
//Leaderboard
void OnMouseDown() {
if (Social.localUser.authenticated) {
Social.ReportScore(PlayerPrefs.GetFloat("l1btime"), A1ft, (bool success) => {
if (success) {
((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(A1ft);
} else {
//Debug.Log("Login failed for some reason");
}
});
}
}
}
And here’s the compiler error.
Assets/Scripts/C#/zebz_1A.cs(19,32): error CS1502: The best overloaded method match for `UnityEngine.Social.ReportScore(long, string, System.Action<bool>)' has some invalid arguments
The only difference between this script and the one I used to create the points leaderboard is the player pref called is a float and not an int. These floats are times and the decimal is very important to the times. I’m pretty much at a stand still and have run out of ideas.
Is there any way of making a timer out of an int so I can save it as a pref? because the only thing this google play service will accept is ints.
Cheers for any help.