How can I change a material only during specific animations?

Okay so I DO have it set up so it only changes the material for the duration of the animation, but I’m stuck on actually having it change to a specific material during a specific animation (i.e. one mouth material is for attacking, one for climbing, etc.). I’ve tried both GetCurrentAnimatorStateInfo IsName and nameHash, neither have worked so far.
Here’s what I have:

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

public class PlayerMouthAnimator : MonoBehaviour {

	public Material mouthDefault, mouthAttack, mouthLookBack;
	public Renderer mouthRenderer;
	float animTimer;
	public Animator _anim;
	static int AttackState = Animator.StringToHash ("GroundAttacks");
	static int ClimbState = Animator.StringToHash ("LedgeStates");

	// Use this for initialization
	void Start () {
		mouthRenderer.material = mouthDefault;
	// Update is called once per frame
	void FixedUpdate () {
		if (_anim.GetCurrentAnimatorStateInfo (0).nameHash == AttackState) {
			animTimer = _anim.GetCurrentAnimatorClipInfo (0).Length - 0.4f;
			mouthRenderer.material = mouthAttack;
		if (_anim.GetCurrentAnimatorStateInfo (0).nameHash == ClimbState) {
			animTimer = _anim.GetCurrentAnimatorClipInfo (0).Length;
			mouthRenderer.material = mouthLookBack;

		if (animTimer > 0) {
			animTimer -= Time.deltaTime;
		if (animTimer <= 0) {
			mouthRenderer.material = mouthDefault;


But every time I test, neither of these animation states actually change the mouth material. It’s starting to get a bit frustrating so any help is appreciated.

Try using AnimatorStateInfo.shortNameHash instead of nameHash as you are comparing with just the state name.