Godot doesn't detect KEY_PRINT?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BlotoPK

Hello guys. I just want to know when the player takes a print screen, but somehow Godot seems unable to detect that key in particular.

func _input(event):
     if Input.is_key_pressed(KEY_DELETE): #or any other key
          print("works fine")
     if Input.is_key_pressed(KEY_PRINT):
          print("...this not :c")
:bust_in_silhouette: Reply From: magicalogic

Try this:

func _input(event):
    if event is InputEventKey:
        if event.scancode == KEY_PRINT:
            print("print screen pressed")

You don’t need to use Input.is_key_presssed() inside _input(event) function.

Thank you very much.

BlotoPK | 2021-05-12 04:54