public void Upgrade() { CurrentLevel = build.Tower.GetComponent <Tower>().level; TowerType = build.Tower.GetComponent <Tower>().TowerType; foreach (GameObject TowerModel in Towers) { if (TowerType.Equals(TowerModel.GetComponent <Tower>().TowerType) && CurrentLevel + 1 == TowerModel.GetComponent <Tower>().level) { ui.buildTower(TowerModel, build.Tower.GetComponent <Transform>().position, ui.UpgradeNode, build.Tower, build.TowerCanvasclicked); } } }