is there a way to keep track of how many upgrades youve bought?
so this is what i did but i didnt work.
code:
using UnityEngine;
using System.Collections;
public class UpgradeManger : MonoBehaviour {
public RPB click;
public UnityEngine.UI.Text itemInfo;
public UnityEngine.UI.Text items;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float _newCost;
[SerializeField] private float currentAmount;
[SerializeField] private float speed;
void Update() {
itemInfo.text = "
$" + cost;
if (count > 24) {
speed = 50;
}
items.text = count;
}
public void PurchasedUpgrade() {
if (click.money >= cost) {
click.money -= cost;
count += 1;
click.moneyperclick += clickPower;
cost = Mathf.Round (cost * 1.05f);
_newCost = Mathf.Pow (cost, _newCost = cost);
}
if (count > 24) {
speed = 50;
}
}
}
error: Assets/UpgradeManger.cs(22,23): error CS0029: Cannot implicitly convert type int' to
string’
Show less