SetTrigger in 2D Movement Problem

Hi …

I’m trying to make an example as the one of 2d game.


private var anim : Animator;

function Awake () 
{
	anim = transform.root.gameObject.GetComponent(Animator);
	playerCtrl = transform.root.gameObject.GetComponent(PlayerController);
}


function Update () 
{
    if ( Input.GetButtonDown("Fire1") )
    {
    		anim.SetTrigger("Shoot");
    }
}

but the SetTrigger dosen’t work correctly

the “Shoot” value has to back to the false in next frame , but it doesn’t

how can I fix this problem ?

please .... up

please mark my reply as answer if it helped

1 Answer

1

You can use this in the beginning of your update to reset it:

anim.ResetTrigger("Shoot");

Actually I didn't try it because it's worked , maybe after I upgrade to the new version . but thanks :)