Are we playing any animations?
var anim: Animation;
function Start() { anim = GetComponent.<Animation>(); }
// Plays an animation only if we are not playing it already. function OnMouseEnter() { if (!anim.isPlaying) anim.Play(); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public Animation anim; void Start() { anim = GetComponent<Animation>(); } void OnMouseEnter() { if (!anim.isPlaying) anim.Play(); } }