- Home /
Animation does not transition
I'm currently working on a game, and it is very close to being in an 'Alpha' type stage. My only problem in the current version in one of my codes the animation won't transition. It will only play the Idle1 animation. How do I fix this? using UnityEngine; using System.Collections;
public class PlayerRotate : MonoBehaviour {
private Vector3 vCurr = Vector3.zero;
public AnimationClip Walk;
public AnimationClip Idle1;
void Start() {
transform.eulerAngles = vCurr;
}
void Update() {
Vector3 vNext = vCurr;
if (Input.GetKeyDown (KeyCode.UpArrow)) {
animation.CrossFade ("Walk");
vNext.y += 0f;
}
else
{
animation.CrossFade ("Idle1");
}
if (Input.GetKeyDown (KeyCode.DownArrow)) {
vNext.y -= 0f;
}
if (Input.GetKeyDown (KeyCode.LeftArrow)) {
vNext.y += -90f;
}
if (Input.GetKeyDown (KeyCode.RightArrow)) {
vNext.y -= -90.0f;
}
if (vNext != vCurr) {
transform.eulerAngles = vNext;
vCurr = vNext;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Perform Action on frame/time of animation 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Play animation function 0 Answers
Get information from variable 1 Answer