I have no idea why this seemingly simple bit of code is not working. Any help would be appreciated.
function OnTriggerEnter (collision : Collider) {
if (collision.gameObject.name == "Enemy1(Clone)" && canExplode == true){
collision.GetComponent(EnemyHealthScript).LooseHealth(30);
Destroy (gameObject);
}
}
Im using a trigger, the log says there is an error in the line collision.GetComponent(EnemyHealthScript).LooseHealth(30); but I dont see it.
– simonheartscake