What does The left-hand side of an assignment must be a variable, a property or an indexer error mean?

In my game I’m trying to disable a navMeshAgent using a bool from an animatorController (tried the normal bool, didn’t work for some reason) But after I have scripted the bool to change and disable the mesh I get this error. error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer Id like to know what this means and how i can fix it. Here is my script for reference.

public class ZobieAnim : MonoBehaviour {

	Animator Z_Anim;

	public NavMeshAgent agent;


	// Use this for initialization
	void Start () {
		Z_Anim = GetComponent<Animator> ();
	}
	
	// Update is called once per frame
	void Update () {
		
		bool IsDying = Input.GetKey("e");
		Z_Anim.SetBool ("IsDead", IsDying);

		//This is where the error is
		if (Z_Anim.GetBool ("IsDead") = true) {
			agent.enabled = false;
		}
	}

You are using the assignment operator ‘=’ in an if statement where you need to use the Equality operator ‘==’ or (in your case) nothing at all. In your case, you should be able to do either

if (Z_Anim.GetBool ("IsDead") == true) 
{
       agent.enabled = false;
}

or, since GetBool returns a bool

if (Z_Anim.GetBool ("IsDead")) 
{
       agent.enabled = false;
}

= is the Assignment Operator. It’s used to assign the value or reference on the right side of the operator to the variable on the left side of the operator.

== is the Equals Operator. It takes the values or references to the left and right of the operator, and reads as true if the values are exactly equal, and false if they’re not equal.

You’re using the first one and you want the second. Change = to ==.