Question by
kzl95 · Jun 07, 2016 at 01:18 PM ·
animation2d animationanimation script
reverse animation error
im trying to scale my character using animation on button press, this is the code im using
using UnityEngine;
using System.Collections;
public class characterControl : MonoBehaviour {
Animator anim;
void Start ()
{
anim = GetComponent<Animator> ();
}
void Update ()
{
//--------------------------Expand----------------------------------------
if(Input.GetKeyDown(KeyCode.UpArrow))
{
anim.Play("I");
anim.speed = 1;
}
if(Input.GetKeyUp(KeyCode.UpArrow))
{
anim.Play("I");
anim.speed = 0;
}
//-------------------------Contract---------------------------------------
if(Input.GetKeyDown(KeyCode.DownArrow))
{
anim.Play("I");
anim.speed = -1;
}
if(Input.GetKeyUp(KeyCode.DownArrow))
{
anim.Play("I");
anim.speed = 0;
}
}
}
but im getting this error
Animator.speed can only be negative when Animator recorder is enabled. Animator.recorderMode != AnimatorRecorderMode.Offline
and using 2 animation for expand and contract wont satisfy my need so i want to do it by making speed in -1, please help!
Comment
Your answer

Follow this Question
Related Questions
Root Motion prevents transform in animation from running 0 Answers
How do I stop an animation from looping? 1 Answer
2D Mirroring animations not working. Unity 5. 0 Answers
Display cooldown timer 1 Answer