using UnityEngine; using System.Collections; public class player : MonoBehaviour { private Animator anim; private float h; // Use this for initialization void Start () { anim = GetComponent(); } // Update is called once per frame void Update () { h = Input.GetAxis("Horizontal"); } void FixedUpdate() { anim.SetFloat("Speed", h); } }