- Home /
Question by
NerdRageStudios · Nov 05, 2014 at 06:30 PM ·
animationmecanimyield
Preventing player moving during reload mecanim animation
Hi all, as the title says, I have my character animations all setup, one of them being a reload animation, but I need to prevent the character from moving when the animation is being played.
I guess the best way to do it is in the code where I call the animation. I use the following simple code for this:
void Reloading (bool reload)
{
bool reloading = reload != false;
anim.SetBool("IsReloading", reloading);
}
My question is, how could I disable the character from moving until the animation is complete, is code I can use that is similar to a yield that will wait until the transition back to idle occurs?
I hope this makes sense!!
Comment
Best Answer
Answer by NerdRageStudios · Nov 06, 2014 at 01:43 PM
Figured it out myself, wrote a function do disable the movement script and then used animation events to trigger it