Plays animation without any blending.
Play() will start animation with name animation
, or play the default animation.
The animation will be played abruptly without any blending.
// Plays the default animation animation.Play();
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { animation.Play(); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Example() as void: animation.Play()
For a specific animation, you can call the animation with play as well.
// Plays the walk animation - stops all other animations in the same layer animation.Play("walk"); // Plays the walk animation - stops all other animations animation.Play("walk", PlayMode.StopAll);
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { animation.Play("walk"); animation.Play("walk", PlayMode.StopAll); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Example() as void: animation.Play('walk') animation.Play('walk', PlayMode.StopAll)