The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

In my application, I added some code to look for the Alt key to be pressed, but it did not seem to work by checking for a scancode equal to KEY_ALT.

So, I checked the scancode on the event, and when I press my Alt key it is being reported as KEY_MENU instead of KEY_ALT. And if I press the Menu key on my keyboard, it reports as KEY_UNKNOWN. I tried a different keyboard to make sure it wasn't just mine and it does the same thing.

Can someone else attempt to recreate this so I can confirm it's not just an issue on my end? Thanks!

func _input(event):
    if (event.type == InputEvent.KEY):
       print(event.scancode)

I get 16777262 (KEY_MENU) when I press Alt, and 33554431 (KEY_UNKNOWN) when I press the Menu key.

in Engine by (32 points)
edited by

Share the script you used to the tests would help a bit.

I updated my post with some more details.

1 Answer

0 votes

I have an iMac and use its native keyboard (no menu key) but pressing 'alt' key gives me 16777240 which is correct. Other keys are correct too, according to @Global Scope

by (659 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.