Is the animation named name
playing?
var anim: Animation;
function Start() { anim = GetComponent.<Animation>(); }
// Plays an animation only if we are not playing it already. function OnMouseEnter() { if (!anim.IsPlaying("mouseOverEffect")) anim.Play("mouseOverEffect"); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public Animation anim; void Start() { anim = GetComponent<Animation>(); } void OnMouseEnter() { if (!anim.IsPlaying("mouseOverEffect")) anim.Play("mouseOverEffect"); } }