Unity increasing more than i want!

Hi, i created the simple code and put in OnGui:

if (Input.GetKeyDown(KeyCode.N))

    if(nextDialog < 40)
          dialogText = dialogTextVector[nextDialog];


But when i get the key N down, the code actually does nextDialog += 2… that means, the number go 2 by 2, not 1 by 1… Why this happens?
And why if i put this command in function Update () doesn`t work?

Thanks Guys.

Don’t check for Input in OnGUI. Do that in Update. OnGUI gets called several times per frame, Update is called once per frame.
You might want to post your Update code so we can see why that didn’t work for you.