Hey!
I am working on a target/select script for my towerdefence game. When I click a tower for example I want to be able to read stats from that tower, such as health and armor. Atm I am trying to access the name from this object aswell but I just can’t retrieve it.
if(hitTower.collider.tag == "MiniTower"){
targetClicked = true;
mainTowerClicked = false;
enemyClicked = false;
//showHealth : MiniTowerHP;
showStats = hitTower.collider.gameObject.GetComponent(MiniTowerHP);
getHealth = showStats.currentHealth;
getMaxHealth = showStats.healthTower;
getArmor = showStats.armor;
retriewName = showStats.name; //here is where the error comes
//showHealth = hitTower.collider.gameObject.MiniTowerHP.currentHealth;
}
And it’s trying to access this String, which is in another script:
public var name : String;
Thanks in advance!