Stops all playing animations that were started with this Animation.
Stopping an animation also Rewinds it to the Start.
using UnityEngine;
public class ExampleScript : MonoBehaviour { Animation anim;
void Start() { anim = GetComponent<Animation>(); }
void Update() { if (Input.GetButtonDown("Jump") && anim.isPlaying) { anim.Stop(); } } }
Stops an animation named name
.
Stopping an animation also Rewinds it to the Start.
using UnityEngine;
public class ExampleScript : MonoBehaviour { Animation anim;
void Start() { anim = GetComponent<Animation>(); }
void Update() { if (Input.GetButtonDown("Jump") && anim.isPlaying) { anim.Stop("CubeJump"); } } }