Number not increasing in Play Mode, but updates after stopping and restarting the game
Good afternoon
Hope you're having a good day today. Wondering if you can help, please. I have an incremental clicker game, and a button that buys a hero and it works fine. But I also have a level up button with the intended intention of increasing his float damage by 1.
I have all the inspector fields linked up to prefabs
Here's the relevant code:
public void PurchaseHeroOne()
{
if (GoldScript.goldAmount >= HeroOneTextScript.costAmount)
{
if (GameObject.Find("HeroOneGO"))
{
LevelUpHeroOne();
}
else
{
GameObject HeroOneGO = Instantiate(HeroOnePrefab, transform.position, Quaternion.identity);
HeroOneGO.name = "HeroOneGO";
}
GoldScript.goldAmount -= HeroOneTextScript.costAmount;
heroOneBuyButton.gameObject.SetActive(false);
}
}
public void LevelUpHeroOne()
{
if (GoldScript.goldAmount >= HeroOneTextScript.costAmount)
{
heroOneScript.UpdateDamage();
GoldScript.goldAmount -= HeroOneTextScript.costAmount;
}
}
public void UpdateDamage()
{
damage += damageIncreaseAmount;
}
Kind regards
Comment