User Input not working

Hi,

My code is as below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HelloWorld : MonoBehaviour {

// Use this for initialization
void Start () {
    float location = 5.0f;
    float homeLocation = 2.1f;
    //float distance = location - homeLocation;
    print ("Welcome to GoHome !");
    print ("A game where you need to find your way back");
    print ("Location:" + location);
    if (location > homeLocation) {
        print ("Go back to get home");
    }
    if (location < homeLocation) {
        print ("go forward to get home");
    }
    if (location == homeLocation) {
        print ("you are at home");
    }    

}

// Update is called once per frame
void Update () {
    if (Input.GetKeyDown(KeyCode.LeftBracket))
        print ("left bracket key pressed");
}

}

But when I run my game, nothing gets printed on console when I press left bracket key. There is also no error.I tried Debug.Log but nothing gets printed either. Pls helpI am not able to proceed becuae of this.
I am using Unity 5.5.Infact I checked none of the functions of the Input class work on my machine.
Thanks.

Privacy & Terms