Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool running = false;
- function Update () {
- bool lastRunningState = running;
- running = (Mathf.Abs(Input.GetAxis("Horizontal")) > 0.1);
- if (lastRunningState != running) {
- if (runnning) {
- animation.CrossFade("Run");
- } else {
- animation.CrossFade("Idle");
- }
- lastRunningState = running;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment