기술 자료

Unity Engine

Unity Engine

Stop

Stops all playing animations that were started with this Animation.
읽는 시간 1분최근 업데이트: 한 달 전

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

name

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