I have the states linked up with the parameter of speed and I followed the tutorial on unity website for 2d character controller and my character moves but does not play the run animation. I dont kno if im using the SetFloat wrong but please help if u can thanks.
public float maxSpeed = 10f;
bool facingRight = true;
Animator anim;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
void FixedUpdate ()
{
float move = Input.GetAxis ("Horizontal");
anim.SetFloat("speed", Mathf.Abs(move));
rigidbody2D.velocity = new Vector2 ( move * maxSpeed, rigidbody2D.velocity.y);
if(move> 0 && !facingRight)
Flip ();
else if (move < 0 && facingRight)
Flip ();
}
void Flip()
{
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}