In the first script I set the price (110.9) for a purchasable item
public class Shop : MonoBehaviour
{
public MoneyManager theMM;
private void OkClicked()
{
theMM.AddMoney((int)-110.9);
}
}
In the MoneyManager script it arrives as a whole number (110)
public class MoneyManager : MonoBehaviour
{
public int currentMoney;
void Start()
{
moneyText.text = "Money: " + currentMoney;
}
public void AddMoney(int moneyToAdd)
{
currentMoney += moneyToAdd;
moneyText.text = "Money: " + currentMoney;
Debug.Log(moneyToAdd);
}
}
In Debug.Log it says “110”.
I just can’t see what’s making that .9 disappear.
Can somebody please help me?