Trying to setbool of animator from another object c#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Die : MonoBehaviour
	public GameObject _gameObject;

	void Update ()

	void OnTriggerEnter (Collider col)
		if (col.gameObject.tag == "Weapon")
			_gameObject.GetComponent<Animator>.SetBool ("isDead", true);
			_gameObject.GetComponent<Chase>().enabled = false;

You don’t told us what is your problem, but as i can see, there is a sintax problem.

_gameObject.GetComponent<Animator>.SetBool("isDead", true); //Wrong.

_gameObject.GetComponent<Animator>().SetBool("isDead", true); //Sintax ok.

But why?

GetComponent is a generic method!


You can say this:

 var animator = GetComponent<Animator>();
 animator.SetBool("isDead", true);