- Home /
Detect if is playing an animation
How can I detect if there is an animation playing? I want to make that if your playing an animation, and touch anything, the animation stops CAn someone help me?
Answer by skovacs1 · Nov 04, 2010 at 07:20 PM
Use Animation.isPlaying
to detect if the specified Animation is playing any animations.
For your use case, you shouldn't need to detect whether an animation is playing. Simply calling Animation.Stop
will stop all animations running on the specified animation component. So you check for "touching anything" (Not sure if you mean the animating object or the user through a touch interface or some other kind of touching) and the just always call animation.Stop(); on the objects whose animation components you want to stop playing whenever your touch detection returns true.