Hi, so I have this animation that needs to be played when the player is moving. It is working in the editor but it doesn’t work on my android phone. Is there something wrong with my script?`public float speed=6f;
Animator anim;
void Start(){
anim = GetComponent<Animator> ();
}
void Update () {
if (Input.touchCount == 1)
{
Touch touch = Input.touches[0];
if (touch.position.x > Screen.width/2){
transform.Translate(Vector2.right*speed*Time.deltaTime);
transform.eulerAngles = new Vector2(0,0);
}
else if (touch.position.x < Screen.width/2){
transform.Translate(Vector2.right*speed*Time.deltaTime);
transform.eulerAngles = new Vector2(0,180);
}
anim.SetFloat ("speed", Mathf.Abs (Input.GetAxisRaw("Horizontal")));
}
}`
I have a variable, speed, which is 0 when the player is still and it’s set to 1 to make the player move.