Animator Trigger Not Working


Im trying to use the Animator to trigger two different animations “OpenLargeBox” and “CloseLargeBox”. You walk up to the Large Box that has a trigger parented to it with a script that checks OnEnterStay if you are tagged Player and if the player has pressed “E” to activate the “OpenLargeBox” Animation in the Animator.

so what should happen is if the Large Box is closed you should be able to walk into the trigger press “E” and it activates the “OpenLargeBox” animation. if the Large Box is Opened you should be abled to walk into the trigger and press “E” and it activates the “CloseLargeBox” animation.

Here is the link to the video tutorial i watched and based it off of. (

Iv done this before but with the unity 5 update its now not working for me, any help is much appreciated, Thanks in advanced.

Here is the code that is on the Large Box Trigger
#pragma strict

var LargeBox : GameObject;
var LargeBoxAnim : Animator;
var LargeBoxOpenHash : int;
var LargeBoxCloseHash : int;
var LBOpen : boolean;

function Start () 
	LargeBoxAnim = LargeBox.GetComponent (Animator);
	LargeBoxOpenHash = LargeBoxAnim.StringToHash("OpenLargeBox");
	LargeBoxCloseHash = LargeBoxAnim.StringToHash("CloseLargeBox");

function OnTriggerStay (other : Collider) 
	if(other.tag == "Player")
			if(LBOpen == false)
				LargeBoxAnim.SetTrigger (LargeBoxOpenHash);
			if(LBOpen == true)
			    LargeBoxAnim.SetTrigger (LargeBoxCloseHash);
			LBOpen = !LBOpen;

Screen Shots

So weird, my 1 is working fine, but I using Animator.StringToHash

Maybe u try with this

LargeBoxOpenHash = Animator.StringToHash(“OpenLargeBox”);

LargeBoxCloseHash = Animator.StringToHash(“CloseLargeBox”);


Oh ya…I juz checked my code, I do the string to hash outside the start function

var LargeBoxOpenHash : int = Animator.StringToHash(“OpenLargeBox”);

var LargeBoxCloseHash : int = Animator.StringToHash(“CloseLargeBox”);