Help needed:Tower Defense Upgrading Tower 2 or more times (Brackey’s tuts all completed)

Updated on July 5, 2018 in [A] C# .Net
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on July 5, 2018

Hey there,

I’ve been watching tutorial 19 a few times now but I can’t seem to figuer out why my upgraded turret won’t upgrade a 2nd time. 

At this moment I have 3 buttons at any time. Upgrade1, Upgrade2 and Sell. I managed to get only Upgrade1 or 2 to work at the same time and also accros all the towers. Nothing is disabled I used interactable instead on the switches. Its an oke fix for now, but I will still love to have a fix where you can only see 1 local (when klicking on Turret 1) Upgrade option at the time, and making sure there is a check wether this tower is on Upgrade 1 or 2.

I will include the NodeUI script. The hookups to Upgraded + Upgraded2 + Maxed work fine.

Is there a posibility to convert/transform the UpgradeButton 1 to UpgradeButton 2? That would also solve the problem I think. Its either upgrade or sell, never downgrade.



using UnityEngine;
using UnityEngine.UI;
public class NodeUI : MonoBehaviour {
public GameObject ui;
public Text upgradeCost;
public Button upgradeButton;
public Text upgradeCost2;
public Button upgradeButton2;
private Nodes target;
public void SetTarget (Nodes _target)
target = _target;
transform.position = target.GetBuildPosition();
if (!target.isUpgraded)
upgradeCost.text = "$" + target.turretBlueprint.upgradeCost;
upgradeButton.interactable = true;
if (target.isUpgraded2)
upgradeCost.text = "$" + target.turretBlueprint2.upgradeCost2;
upgradeButton2.interactable = true;
// upgrade2Button.enabled = true;
if (target.isMaxed)
upgradeCost.text = "Maxed out";
upgradeButton.interactable = false;
public void Hide ()
public void Upgrade()
public void Upgrade2()

Thanks in advance!

  • Liked by