// Use this for initialization public void ReactToHit() { if (shotcounter == 1) { Shooting behavior = GetComponent <Shooting> (); if (behavior != null) { behavior.SetAlive(false); } WanderingNPC b = GetComponent <WanderingNPC> (); if (b != null) { b.SetAlive(false); } GameObject s = GameObject.FindGameObjectWithTag("Respawn"); Spawning sp = s.GetComponent <Spawning> (); sp.decrementCounter(); StartCoroutine(Die()); } else { shotcounter++; } }