Godot doesn't recognize any input

Godot Version

4.4.1.stable

Question

I am new to godot and game development in general, so it may be an obvious mistake, I apologize for that. To get to the point, I have followed the Learn Godot by Making Minecraft tutorial. When using the basic CharacterBody3D script template and replacing the everything to be the same as in the video move_and_slide() command worked for gravity. However movement using A,W,S,D and space, mapped in input map doesn’t seem to register.
I have used:

func _ready() -> void:
var evt = InputEventKey.new()
evt.physical_keycode=KEY_SPACE
print(InputMap.action_has_event("jump", evt))

func _input(event: InputEvent) -> void:
if event is InputEventKey:
print("Raw Key Event: ", event.as_text(), " - Pressed: ", event.is_pressed())
if event is InputEventMouseButton:
print("Raw Mouse Button: ", event.button_index, " - Pressed: ", event.is_pressed())

The commands were generated by Gemini and found on forum(first one). From what I see it should show if key is pressed yet it returns nothing. However, it returns true for space key being mapped, using _ready().
The Input.get_vector("left", "right", "up", "down") doesn’t do anything the vector is always (0.0, 0.0).

If there is any information I forgot to mention I apologize.

Thanks for any help in advance.

It turned out that, by just closing Godot and opening it again, it started working. If anyone knows why, I’d be grateful for an explanation.
Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.