I used ...

func _input(event): 
     print(event)

... in my main scene to test this, in both Godot 3.5 and Godot 4. On ALL projects so far in Godot 4 the keyboard does not trigger any input events until AFTER I have alt-tabbed out of the game and back into it OR the keyboard does not trigger any input events until after I have clicked the mouse at least once somewhere in the game window. This behavior does not occur on any of my projects in Godot 3.5. This behavior ONLY occurs in Fullscreen and Fullscreen Exclusive modes, in Godot 4. Windowed projects register keyboard events perfectly.

I am tearing my hair out trying to work out the cause. Any suggestions would be appreciated.

P.S. It doesn't matter what my code is. This happens even in a completely blank project in Godot 4, with only the two lines "func _input(event):" followed by "print(event)." in the main scene. (Also the behaviour occurs when running in both the editor and when running an exported project.)

EDIT TO ADD: Found something odd that I'm sure is related. Keypresses that I do before clicking or alt-tabbing are showing up in the GDSCRIPT EDITOR. So I'm guessing the issue has something to do with focus?

Input is working for me but when using functions like is action pressed. Maybe it's the printing function doesn't work cause that's an odd code to use outside debugging.

cast the event into a string within that print statement, I bet it'll print then.

I don't care about printing it, I'm using it to debug the problem.

I just made a new project with a new CharacterBody3D in it, with the default movement setup, and the character WILL NOT MOVE until after I have clicked the mouse or alt-tabbed out and back into the scene. There are no other input handling functions anywhere, just the default one (in case that's what might be interfering).

This isn't limited to characters or movement. The keyboard will NEVER report an input to any function until after alt-tab or mouse click.

EDIT TO ADD: Found something odd that I'm sure is related. Keypresses that I do before clicking or alt-tabbing are showing up in the GDSCRIPT EDITOR. So I'm guessing the issue has something to do with focus?

This is proving seriously problematic, that the keyboard is ignored until after a mouse click. Any thoughts as to why this might be happening would be greatly appreciated. I am frustrated beyond belief by this.

I think you might have a bug on your hands, perhaps make a report to the issue tracker. And yes, it sounds like a focus issue.

    Megalomaniak
    Pretty sure you're right. I've confirmed the Godot Editor is stealing focus from the game window. Just can't figure out why.

    I don't have that issue on Linux. Are you on Windows? Sounds like a bug.

      cybereality
      Yes, Windows 10.

      Also to be clear this only happens with 4.0, so I'm assuming it's not a hardware issue.

      I've reported it on Github. Hopefully someone will have a solution.

      2 months later

      Have you managed to solve this issue yet? I think I am having the same issue (However, I am new to the software so not 100% sure)