I have scripts:
(in Missile)
void OnCollisionEnter(Collider
collision) { if
(collision.gameObject.name ==
"ZombieSpawn(Clone)"){ EnemyFight
efight =
collision.GetComponent<EnemyFight>();
efight.DecaraseHP(10);
} }
and something in EnemyFight (script)
public int enemyMaxHp = 10;
public int enemyHp = 10;
and
> public void DecaraseHP(int minusHP) {
> enemyHp -= minusHP;
}
What’s mine problem? When i shoot to enemy a last created enemy take damage, not this enemy who are shooted by me. Please help me!
I searched on google but nothing works.