I want to check in every frame (physics_process or process) if player is holding mouse button and shift button. What I've tried so far was trying:

Input.is_key_pressed and !Input.is_key_pressed

is_action_pressed and is_action_released

is_action_just_pressed and is_action_just_released

Input is recognizing when I hit the shift key but not when I release that key. Maybe is_echo() does the job? But I have no clue how to work with that method.

OK, I have found a solution:

func _physics_process(delta) if Input.is_mouse_button_pressed(BUTTON_MIDDLE) and Input.is_key_pressed(KEY_SHIFT): print("it works")

Edit: Nope, does not work. After first time usage Godot does not recognize that "Shift" is not pressed anymore and it is then triggered without pressing shift...

(how can i remove the "Answered" tag btw?)

Edit2: Found out that is_echo() works as expected with Aa-Zz Keys but not with Modifier Keys (ALT, STRG, SHIFT). Seems to be an issue: https://github.com/godotengine/godot/issues/6388

OK, definitely a bug (at least on my linux system with Godot 3.0.2). I have wrote a small test script, could anyone please test this and post if it is working as intended? WIth key_u it is doing it's job like expected, with "shift" it does not recognize that key was released...

action("shift") == SHIFT Key action("key_u") == any key from a to z

func _physics_process(delta): if Input.is_action_just_pressed("shift"): print("shift pressed") if Input.is_action_just_released("shift"): print("shift released") if Input.is_action_just_pressed("key_u"): print("key_u pressed") if Input.is_action_just_released("key_u"): print("key_u released")

Edit: After some more testing I now definitely know, what causes that issue. I am using the german neo 2 keyboard layout. If switching to "qwert" layout, it is working perfectly. Anyone knows if a workaround is existing?

4 years later

I'm very new to Godot and i'm having a lot of trouble trying to find information on this sort of problem since im tryna use C# instead of GDscript. Do you know how I would write it out in that?

Also i'm new to programming in general and I heard GDScript is easier, but I wanna know a language that I can use outside of Godot as well.

Honestly, you are better off with GDScript as a beginner. It is similar to Python (actually very similar) so it would not be hard to use Python after using GDScript. And Python is more useful than C#. It can be used to write short scripts or OS plugins, simple games, or complex machine learning and statistics. I would say it's the most useful language to know right now.

10 months later