Help

So when I created another thread, I didn’t explain what I was doing so ill explain.

using UnityEngine;

public class UpgradeManager : MonoBehaviour {

    public Click click;
    public UnityEngine.UI.Text itemInfo;
    public float cost;
    public int count = 0;
    public int clickPower;
    public string itemName;
    private float _newCost;

    void Update() {
        itemInfo.text = itemName + "\nCost: " + cost + "\nPower: +" + clickPower;

    }

    public void PurchasedUpgrade() {
        if (click.cookie >= cost) {
            click.cookie -= cost;
            count += 1;
            click.cookieperclick += clickPower;
            cost = Mathf.Round(cost * 1.15f);
            _newCost = Mathf.Pow(cost, _newCost = cost);

        }

    }


}

What I’m trying to do is create upgrades for a game I was making. But when I tried to make my code click.cookie -= cost; it was wrong, so I changed public float cost to public int cost, click.cookie -= cost; was right but Mathf.Round(cost * 1.15f); became wrong. So I need help I have no idea what to do in this situation.

Non-descript title.

Reference to another thread, but no link to it, nor did you just update that thread with this information.

What do you mean that “it was wrong”, this also is non-descript.

You may want to work on how well you communicate information to others.

ok

You’re trying to subtract a float from an int. Just make them both ints, or both floats.

Floats might give you a slightly wrong result, like you’ve said, so they’re not suited to item prices. Just use ints and make the item price 115.