Question by
SimonClintonIv · Jul 02, 2016 at 04:40 PM ·
animationpause
How to pause an animation
For example my game object is climbing a ladder and a climbing animation is played at the same time. If the game object stops at the middle of the ladder, I want the climbing animation to be paused at current animation pose at the moment.
Comment
Best Answer
Answer by RyanDiCenzo · Jul 03, 2016 at 11:06 PM
animation["Walk"].speed = 0;
This seemed to work for another user.
using UnityEngine;
using System.Collections;
public class ToAnimate : $$anonymous$$onoBehaviour {
public Animation anim;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.A))
{
GetComponent<Animation> ().Play ("Anim1");
}
if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.B))
{
anim ["Anim1"].speed = 0;
}
}
}
The code isn't working in my animation code. And I have tried this before.
Sorry I forgot one step. I forgot to add game object.