convert float to int for google leaderboard

Hi

i have a new mode where score is measured by distance, i’ve got it working fine in game and saving in player pref, but unsure how to report it back to google leaderboard as float…

here is my distance player pref script - working

float distanceunit = 0;
float bestDistanceunit;

private void Awake()
{
if (PlayerPrefs.HasKey(“BestDistanceBulking”))
{
bestDistanceunit = PlayerPrefs.GetFloat(“BestDistanceBulking”);
}

private void Update()
{
currentSpeed = Mathf.SmoothStep(minSpeed, maxSpeed, time / accelerationTime);
transform.position += Vector3.right * currentSpeed * Time.deltaTime;
time += Time.deltaTime;

    if (distanceIncreasing)
    {
        distanceunit += pointsPerSecond * Time.deltaTime;
    }
    if (distanceunit > bestDistanceunit)
    {
        bestDistanceunit = distanceunit;
        PlayerPrefs.SetFloat("BestDistanceBulking", bestDistanceunit);
        GPGSLeaderboards.UpdateLeaderboardBestDistanceBulking();
    }

here is part of my gpgsleaderboard script for posting to leaderboard which isnt working…

public static void UpdateLeaderboardDistance()
{
    if (PlayerPrefs.GetFloat("BestDistanceBulking", 0) == 0)
    {
        return;
    }

    Social.ReportScore(PlayerPrefs.GetFloat("BestDistanceBulking", 1), GPGSIds.leaderboard_bulk_chokie__distance_, (bool success) =>
    {
        if (success)
        {
            //PlayerPrefs.SetInt("BestDistanceBulking", 0);
        }
    });
}

Thank you heaps

You could use the ‘Mathf.RoundToInt’ function to round the float however you like