getAxis doesn't work..
it doesn't work.. and i can't find any problem
using UnityEngine; using System.Collections;
public class playerscript : MonoBehaviour {
public Vector2 speed= new Vector2(20,20);
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float inputX = Input.GetAxis ("Horizontal");
float inputY = Input.GetAxis ("vertical");
Vector3 movement= new Vector3 (speed.x*inputX,speed.y*inputY,0);
movement *= Time.deltaTime;
transform.Translate (movement);
}
}
Comment
Best Answer
Answer by Cepheid · Jan 24, 2016 at 12:12 PM
@jinoh The axis names start with a capital letter so the following inputY line should be corrected:
// Original statement.
float inputY = Input.GetAxis("vertical");
// Corrected statement.
float inputY = Input.GetAxis("Vertical");
If that doesn't help then have you checked to see if the axis are correctly setup within your input manager? Sometimes they can glitch out, mine did that a while back and it confused the heck outta me.