- Home /
Question by
sleepytypeguy · Mar 03, 2014 at 12:52 AM ·
c#animationisometricanimation.play
animation.play is not working (did the legacy thing)
Hi, i have a simple script that should animate my player but its not working. i read forums for a while and did the legacy option, but my character still doesn't animate, there isn't any compiling errors. Here is my script:
using UnityEngine;
using System.Collections;
public class maincharacter : MonoBehaviour {
void Start () {
}
float xSpeed = 10f;
float zSpeed = 10f;
public float playerMovementSpeed = 10f;
void Update () {
float deltaX = Input.GetAxis ("Horizontal") * xSpeed;
float deltaZ = Input.GetAxis ("Vertical") * zSpeed;
Vector3 trans = new Vector3 (deltaX + deltaZ ,0f,deltaZ - deltaX);
transform.Translate (trans.normalized * Time.deltaTime * playerMovementSpeed, Space.World);
animation.Play ("mcrunsw");
/*if (deltaX != 0 || deltaZ != 0) {
animation.Play ("mcrunsw");
}*/
}
}
And here is my gameobject and animation:
Any help would be appreciated. Thanks in advance.
animationtrouble.png
(87.5 kB)
Comment