I keep getting this error kind of like this
Assets/UpgradeManager.cs(21,19): error CS0266: Cannot implicitly convert type float' to
int’. An explicit conversion exists (are you missing a cast?)
I don’t really get the problem here, doesn’t seem like theres anything wrong.
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);
}
}
}
The click.cookie -= cost; is apparently wrong
Thanks