- Home /
Why The player don't move?
why it's not working:
private Transform myTrasform;
public int playerSpeed = 5;
// Use this for initialization
void Start () {
myTrasform = transform;
myTrasform.position = new Vector3 (-3, -3, -1);
}
// Update is called once per frame
void Update () {
myTrasform.Translate(Vector3.right * playerSpeed * Input.GetAxis("Horizontal") * Time.deltaTime);
}
Comment
1) make sure playerSpeed in inspector is not zero.
2) $$anonymous$$ake user something else did not changed the Time.timeScale to zero.
3) make sure in Edit -> Project Settings -> Input, you have Horizontal axis defined and it's sensitivity is not zero, it will be there by default unless you have changed it or delete it accidentally. 4) script is added on player. 5) player object is not marked static.
Your answer
Follow this Question
Related Questions
Newbie Spawner C# Help 3 Answers
Same scripts don't work the same way on different objects 0 Answers
How can I spawn different GameObjects using IEnumerator? 1 Answer
Standard cutout shader. Pixely outline. 1 Answer
C# damage script help 1 Answer