You can check what is the current animation is playing.
if (!myAnimator.GetCurrentAnimatorStateInfo(0).IsName(animationName))
myAnimator.SetTrigger(triggerParameterName);
Example in your case:
if (!myAnimator.GetCurrentAnimatorStateInfo(0).IsName("idle"))
myAnimator.SetTrigger("open");
else
myAnimator.SetTrigger("close");
Take Note, that in ‘IsName’ is the name of your state, and in SetTrigger is the trigger using in ‘Animation Parameters’.
I am trying to trigger between open and close, so I need to do something on these lines:
myAnimator.SetTrigger("open");
// if open is on , close is off
myAnimation.SetTrigger("close" = 0);
else
myAnimator.SetTrigger("close");
// if open is off , close is on
myAnimation.SetTrigger("open" = 0);
Does that make sense?
Thanks
~be
The Trigger set in 'false' automatic when the animator use it, you dont need set it 'false' in your code.
Anyone? This seems semantic...
– Bentoon