Script "Destroy" don't work...

Hello all!!
sorry to bother you again; I’ve followed the Survival Shooter tutorial to make a little videogame.

Only one thing is wrong : the enemy don’t stop moving AND don’t desappear from scene when dead…

(He’s really dead though: can’t harm player, and is not shootable anymore)

Here’s the full script :

using UnityEngine;

public class enemyHealth : MonoBehaviour
public int startingHealth = 120;
public int currentHealth;
public AudioClip deathClip;

Animator anim;                             
AudioSource enemyAudio;                     
ParticleSystem hitParticles;               
CapsuleCollider capsuleCollider;           
bool isDead;          


void Awake ()

	anim = GetComponent <Animator> ();
	enemyAudio = GetComponent <AudioSource> ();
	hitParticles = GetComponentInChildren <ParticleSystem> ();
	capsuleCollider = GetComponent <CapsuleCollider> ();
	currentHealth = startingHealth;


void Update ()

	if(currentHealth <= 0)

		Destroy (gameObject);

public void TakeDamage (int amount, Vector3 hitPoint)



	enemyAudio.Play ();

	currentHealth -= amount;

	hitParticles.transform.position = hitPoint;


	if(currentHealth <= 0)

		Death ();

public void Death ()

	isDead = true;

	capsuleCollider.isTrigger = true;
	anim.SetTrigger ("Dead");

	enemyAudio.clip = deathClip;
	enemyAudio.Play ();

	GetComponent <UnityEngine.AI.NavMeshAgent> ().enabled = false;
	GetComponent <Rigidbody> ().isKinematic = true;
	Destroy (gameObject, 2f);


Only one thing comes to my mind - check if the script is attached to the game object you are trying to remove (and not for example it’s child object).


I weiredly made the destroy function in EnemyMouvement script

I delerted it from EnemyHealth script too.

It works great.

Thanks to all dev’s!