- Home /
Duplicate Question
How to play reverse animation?
Hi I want to play reverse animation. ie Move a cube from point A to B and then back from B to A I have tried using links http://answers.unity3d.com/questions/466197/how-to-play-animation-in-reverse.html http://forum.unity3d.com/threads/playing-animation-backwards.15071/
but every time it throws error
Script using is
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
public GameObject cube;
Animator animator;
// Use this for initialization
void Start () {
animator = cube.GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.RightArrow)) {
animator.SetTrigger("move");
}if(Input.GetKey(KeyCode.LeftArrow)) {
animator.animation["@anim"].speed = -1;
animator.SetTrigger("move");
}
}
}
Thanks...
Did you even read the question ? before closing it you fool....? I know what is null pointer exception is...@SaraCecilia
Follow this Question
Related Questions
Rig object offsets during animations 0 Answers
transform.position not setting position OR animation setting position even though it shouldn't 0 Answers
Rig Extra Transforms to Expose in Hierarchy for Bio IK 0 Answers
Animation issue (OnTriggerEnter) ***SOLVED*** 1 Answer
Transformation/Rotation of completed animation to fit on scene 1 Answer