- Home /
Question by
sandiodm · Feb 02, 2015 at 11:19 AM ·
animationanimatoranimation editor
Problem with checking animation is done already or not
im new to unity, and still understanding a few aspect of it.. i have HeroIdle and HeroAttack Animation. i've set transition after attack and back to idle..
i need to loop attack animation a few times, and back to idle after that. what ive tried :
loop 20 times
{
if(first loop)
{
_animator.Play("HeroAttack");
}
else if(_animator.GetCurrentAnimatorStateInfo(0).IsName("HeroAttack")) //is always returning false
{
_animator.Play("HeroAttack");
}
}
so i started to track the problem. and i've found other problem. i tried to delete the transition after HeroAttack back to idle.
loop 20 times
{
if(before last loop)
{
_animator.Play("HeroAttack");
}
else if(last loop)
{
_animator.Play("HeroIdle"); //its always playing Attack animation
}
}
how does unity animations work? and how to solve my first problem?
i really want to learn unity, because after participating in global game jam, unity programmer can produce game faster than mine. previously cocos2d-x but i still didnt know a few things about it. any help is appreciated. or perhaps anyone has any social media account, so i can ask more :3 thanks
Comment