![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | whiteshampoo |
Hi all,
i have the problem that i need to know which mouse-button pressed a Button.
I have this solution:
extends Control
var last_mouse_button : int = -1
var mouse_buttons : Array = ["None", "Left", "Right", "Middle"]
func _input(event : InputEvent) -> void:
if event is InputEventMouseButton:
if event.pressed:
last_mouse_button = event.button_index
func _on_Button_pressed() -> void:
print(mouse_buttons[last_mouse_button])
but i dont think its very elegant and i dont know how reliable this is…
Does anyone know a better solution?