This is required since for each frame, _input might run several times (if you have several input events, such as moving the mouse and clicking it at the same time). As a result, just checking the global state with Input.is_action_just_pressed will return true for both events and will show and hide the console in the same frame. (see https://github.com/godotengine/godot/issues/80158#issuecomment-1661865675)
(to check that it's a problem, you can move the mouse continually and try toggling the console: you'll notice it sometimes doesn't show up)
This is required since for each frame,
_input
might run several times (if you have several input events, such as moving the mouse and clicking it at the same time). As a result, just checking the global state withInput.is_action_just_pressed
will returntrue
for both events and will show and hide the console in the same frame. (see https://github.com/godotengine/godot/issues/80158#issuecomment-1661865675)(to check that it's a problem, you can move the mouse continually and try toggling the console: you'll notice it sometimes doesn't show up)