I made a really simple C# script but my player is moving so fast.
And i don’t know how to fix it.
Here is my script:
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public float playerSpeed = 5.0f;
void Start () {
transform.position = new Vector3(0, 2, 0);
}
void Update () {
if(Input.GetKey(KeyCode.D)){
transform.Translate(new Vector3(1, 0, 0 * playerSpeed * Time.deltaTime));
}
if(Input.GetKey(KeyCode.A)){
transform.Translate(new Vector3(-1, 0, 0 * playerSpeed));
}
if(Input.GetKey(KeyCode.W)){
transform.Translate(new Vector3(0, 0, 1 * playerSpeed));
}
if(Input.GetKey(KeyCode.S)){
transform.Translate(new Vector3(0, 0, -1 * playerSpeed));
}
}
}