- Home /
Set Animator boolean false after animation completes using a blender model
I am using a blender model for my game. The animations are also animated in blender, so I cannot just add an animation event at the end of the animation, as unity says it is read-only. Any ideas as to how to go about this?
Answer by Jan_Sch · Jul 29, 2017 at 06:05 PM
Don't use a boolean, use a Trigger. You can set them up in the Animator window just like other parameters and call them via Animator.SetTrigger("<Name>")
.
Answer by Hanoble · Jul 29, 2017 at 07:01 PM
You can duplicate the animation within Unity and it will no longer be read-only, then use an animation event if that is your preferred way to handle this.
Another possibility is to use a trigger, but I have had a slew of issues in the past where triggers have not successfully reset, so I stopped using them altogether (this was a while ago and they may be better now). If you prefer to avoid triggers, you can setup your own method that in instances where you want trigger like behaviour, you use a coroutine to set the bool, wait X frames or seconds, and then unset it. In your case, you could get the length of your animation clip, pass it to the method, and have it delay for that long before resetting the bool. Something like this:
//This gives you trigger like behavior from a bool
private IEnumerator AnimatorSetFire(float animationLength)
{
animator.SetBool("Fire", true);
//You can wait for seconds, frames, other coroutines, whatever u need
here
yield return new WaitForSeconds(animationLength);
animator.SetBool("Fire", false);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612131457im_/https://answers.unity.com/themes/thub/images/avi.jpg)