- Home /
Question by
Fred_Vicentin · Apr 03, 2014 at 02:49 PM ·
animationspriteanimator
SetBool false on complete animation
I created a sprite with animation, I done the Animation transition and I used SetBool to play the animation.
Now I want to SetBool false when complete the animation transition, for example, play one time and set false again. How can I do this ?
My script:
![public Animator take;
void OnMouseDown ()
{
if(transform.gameObject.tag == "Player")
{
take.SetBool("onClick", true);
}
}
Picture:
untitled.jpg
(303.2 kB)
Comment
Best Answer
Answer by joosenWPL · Apr 03, 2014 at 03:21 PM
Well i'm not very familiar with Animator vs Animation.. I know the animator is a controller so far :)..
This is what I use in my game.
public Animation name;
if(!name.isPlaying)
{
// Animation is finished
}
But note, 'isPlaying' only works for an animation, not for an animator.
Greetz
Your answer
![](https://koobas.hobune.stream/wayback/20220613141846im_/https://answers.unity.com/themes/thub/images/avi.jpg)