Hello, I am new to unity and created a simple script for just movement which works. Now I want to add running with ‘‘left shift’’ key but I cant get it to work. Here is my script with the line for running which I cant get to work: Hope someone can help me out with this.
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
public float playerSpeed = 8.0f;
public float RunSpeed = 10.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Translate (Vector3.right * Input.GetAxis("Horizontal") * playerSpeed * Time.deltaTime);
transform.Translate (Vector3.forward * Input.GetAxis("Vertical") * playerSpeed * Time.deltaTime);
if (Input.GetButtonDown("KeyCode.LeftShift")){
playerSpeed = RunSpeed;
{
}
}