private void OnMouseUp() { if (tower == null) { tower = Instantiate <GameObject>(TowerPrefab, transform.position, Quaternion.identity); } else { if (CanUpgrade()) { TowerData data = tower.GetComponent <TowerData>(); data.IncreaseLevel(); } } }