Hey, this really is my problem area as people will see from my history ^^’
My attack script deals damage to an enemy through this “PlayerAttack” script:
if(distance < 2.3F){
if(direction > 0.25) {
EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
eh.AdjustCurrentHealth(-10);
}
}
Which works fine but the way I get the ‘target’ variable is local in that script, with it changing between gameObjects in an array when I press E but in my arrow script I want to be able to deal damage on arrow collide, how would I go about calling the ‘target’ variable from the attack script and caching it within my arrow script, perhaps on every press of E?
Many thanks.