Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Animation.IsPlaying

Switch to Manual
public function IsPlaying(name: string): bool;

Parameters

Description

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"); }