No key has been input?

How can i say in java script if No key has been input from the main keys which i use for playing?

You should keep a list of KeyCodes in your script, containing all the keys that should be checked for “no input”.

That way you can dynamically add keycodes to check on, while also having an easy way
if any of those keys were pressed.

example of check:

bool wasKeyPressed = false;

foreach(KeyCode key in keyCodeList)


if ( Input.GetKeyDown(key)) wasKeyPressed = true;


You can go through all of your “main keys” in order and check whether they’re pressed. Use a bool to keep track of whether one of them was indeed pressed and check against that.

var mainKeysPressed : boolean;

if (Input.GetKey (KeyCode.A))
    mainKeysPressed = true;

etc. pp. Then, at the end:

if (!mainKeysPressed)
    Debug.Log("No main key pressed.");

Alternatively, check for the name of the input key instead of the raw key type, like

if (Input.GetKey ("down"))
    mainKeysPressed = true;