Convert Float to Int for Google leaderboard
Hi,
So i understand that
Social.ReportScore(highScore, leaderboard)
Will only accept int as the highscore, however my "highscore" is time based e.g. 10.745 If i were to convert my float to int, how would the google leader board know the amount of milliseconds the score has?
Would i need to multiply the int by 10000 and then report the score?
Thanks, sorry if this does not make sense.
Answer by AurimasBlazulionis · Sep 10, 2016 at 05:22 PM
If you are sure that it only accepts ints, then you can multiply the value by 1000 and then cast to int. So it would look like (int)(highscore * 1000f)
. Add that as the int parameter and you should be good to go.
As I am not familiar with google services, you could just simply display your score in miliseconds and only in the game show in seconds. But maybe google leaderboard allows to do some formatting, I don't know.