Animation.isPlaying Manual     Reference     Scripting  
Scripting > Runtime Classes > Animation
Animation.isPlaying

var isPlaying : boolean

Description

Are we playing any animations?

JavaScript
// Plays an animation only if we are not playing it already.
function OnMouseEnter() {
if (!animation.isPlaying)
animation.Play();
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void OnMouseEnter() {
if (!animation.isPlaying)
animation.Play();

}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def OnMouseEnter():
if not animation.isPlaying:
animation.Play()