Question by
Obi02_ · Jul 31, 2017 at 05:03 AM ·
not workingwalkinganimation script
Script that plays animation when player is moving?
I'm creating a 2d platformer and I want to make a script that plays my walking animation when the character is moving right... What I've tried is:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Walk : MonoBehaviour {
public Animation walkright;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.RightArrow))
{
walkright.CrossFade("walkright");
}
else {
walkright.Stop("Walkright");
}
}
}
When I run the script, it comes back with the error: play does not contain a definition in this context
If you can help me, that would be great, I'm new to coding so I wouldn't be surprised if there are problems with the script. ,
Comment