Unity does not register first key press

I’m VERY new to the Unity community and programming and I’m following a course which is awesome, but I’ve run into some issues when making my first text adventure game.

I’m using the following code to get back and it works fine.

if (Input.GetKeyDown(KeyCode.T))
{ myState = States.hule;}

Where “hule” is the Danish word for Cave.

I use the EXACT same syntax for when I want to “see the sheets”

if (Input.GetKeyDown(KeyCode.L))
{myState = States.lagen_0;}

where “lagen” is sheets in Danish. When I press L to view sheets, i Have to press it twice, every time, or else nothing happens.

I’m using Visual Studio as the programming “studio”.

I hope someone can help with this issue.

post your full code.this code looks ok.

1 Answer

1

Even though its over 130 lines of code? I must mention that I haven’t written any comments on the code either.

Omg it worked! :) So, just to be sure that I know what you mean. The first time a new key press is "mentioned" it should be input.GetKeydown(Keycode.[]) correct? and after the first statement, it should be input.Getkey(keycode.[]) ? Am I understanding this correctly?