I am trying to learn unity so i made tried to make a game like the gold mines in Travian. So you can upgrade the mines and you will earn more but my script dosen`t work, when i try to upgrade it i still make the same gold as before. Here is my script:
float Gold;
int Level1Cash = 9;
void Update () {
Gold += 5 * Time.deltaTime;
if (Gold > Level1Cash){
if (Input.GetKeyDown(KeyCode.P)){
Gold -= 10;
Gold += 500000 * Time.deltaTime;
}
}
}
void OnGUI(){
GUI.Box(new Rect(10,10,100,30), "Gold: " + (int)Gold);
}
what is the problem?