Stop
Stops all playing animations that were started with this Animation.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.AnimationModule
Stop()
Stops all playing animations that were started with this Animation.
public void Stop()
Remarks
Stopping an animation also Rewinds it to the Start.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ Animation anim; void Start() { anim = GetComponent<Animation>(); } void Update() { if (Input.GetButtonDown("Jump") && anim.isPlaying) { anim.Stop(); } }}
Stop(string)
Stops an animation named name.
public void Stop(string name)
Parameters
Remarks
Stopping an animation also Rewinds it to the Start.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ Animation anim; void Start() { anim = GetComponent<Animation>(); } void Update() { if (Input.GetButtonDown("Jump") && anim.isPlaying) { anim.Stop("CubeJump"); } }}