//called on DestroyObject script public void Dying() { if (isAlive) { isAlive = false; SpawnController.Instance.actualEnemiesAlive--; gameObject.GetComponent <CapsuleCollider>().enabled = false; animationController.EnemyDiesAnimation(); agent.enabled = false; } }