Sign In Register

How can we help you today?

Start a new topic
Answered

Why does it request expression type long ?

Hi i have been doing the tutorial to integrate a leaderboard into my game. so far so good but when i finally get half way through the 5th video i get an error telling me that i cannot convert my score into a long ? as far as i know i didnt set my game to use long values and my gamesparks api is working fine? any ideas


 public void PostScores(float myScore)

 {

 

  new GameSparks.Api.Requests.LogEventRequest_postScore().Set_Score(myScore).Send((response) =>

    {

   if (response.HasErrors)

   {

    Debug.Log("Failed");

   }

   else

   {

    Debug.Log("Successful");

   }

  });

 }


Assets/Assets/RFTS/Scripts/Game/ShipController.cs(443,73): error CS1503: Argument `#1' cannot convert `float' expression to type `long'



Best Answer

A long is a signed 64-bit integer. Passing a float to a long won't work as they are two very different data types.

Just change your method to accept an int or a long.


1 Comment

Answer

A long is a signed 64-bit integer. Passing a float to a long won't work as they are two very different data types.

Just change your method to accept an int or a long.