Hello everyone,
I have started to figure out Animator feature, but it is still very confusing. The biggest problem is that I have a clip and it is not looped. I set a trigger to make it play when press fire button. And when I press it once clip is keep running in Animator, and animator.GetCurrentAnimationClipState(0).Length
is 1 all the time. What I am doing wrong?
Code sample:
void Update () {
if (animator.GetCurrentAnimationClipState(0).Length == 0f)
{
currentState = hidden;
}
if (control.FirstShoot & currentState)
{
Debug.Log("OPEN!");
animator.SetTrigger("unhide");
hidden = false;
}
else if (control.FirstShoot & !currentState)
{
animator.SetTrigger("hide");
hidden = true;
}
}
[40104-безымянныи.png|40104]