Animator does not contain definition for SetBool

I’m just trying to do a simple trigger for an animation. Mouse is clicked, function executes, boolean gets set to something, causes animation to fire. Except, I keep getting an error message of the type that is in the topic name.

I have no clue what the hell is going on, since I’ve used this method a billion times before, suddenly Unity seems to have gone crazy and forgotten what it can do.

Here’s the code, hope it helps.

using UnityEngine;
using System.Collections;

public class GunControl : MonoBehaviour {

	public GUITexture crosshair;
	private float fireRate = 1.0f;
	private float cooldown = 0f;
	float range = 75.0f;
	private Ray shot;
	private RaycastHit shotInfo;
	private bool isHolstered = true;

	Animator anim;

	// Use this for initialization
	void Awake() {
		anim = GetComponent<Animator>();

	void FixedUpdate () {
		cooldown -= Time.deltaTime;

		anim.SetBool("isShooting", true);

			if(isHolstered) {
				isHolstered = false;
				crosshair.enabled = true;
			} else {
				isHolstered = true;
				crosshair.enabled = false;

		if (Input.GetMouseButton(0) && cooldown <= 0 && !isHolstered)
			shot = new Ray(Camera.main.transform.position, Camera.main.transform.forward);
			Physics.Raycast(shot, out shotInfo, range);
			cooldown = fireRate;
			// Instantiate shot effect here ->
			// Debug and test code
			GameObject go = shotInfo.collider.gameObject;
			Debug.Log("Hit Object name " +;


SetBool needs a name and a value , true or false.


When all else fails, read the docs:

Make sure that the Script name in Project and Class name in script is same,
this will solve the error

I’ve run into this issue recently. Check if you have any other classes defined as Animator. It will override the default Unity Animator from UnityEngine.Animator. You can refer to this article here for more information: Unity C# error: Animator does not contain a definition for ‘SetBool’ — Terresquall Blog