void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player01") { // ... stop the nav mesh agent nav.Stop(); // ... set the PlayerDead parameter inside Animator Controller animator.SetTrigger("PlayerDead"); // ... call players Death function Player_controller playerController = player.gameObject.GetComponent <Player_controller>(); playerController.Death(); } }