0 votes

I have this code in a Node2D scene:

func _unhandled_input(event):
    print("Runner@UnhandledInput")
    print (event.as_text())
    if event is InputEventMouseButton:
        if event.button_index == BUTTON_LEFT:
            if event.pressed:
                print("Mouse event")
    elif event.pressed and event.scancode == KEY_ESCAPE:
            get_tree().quit()

My output if i push a keyboard key (up):

Runner@UnhandledInput Up
Runner@UnhandledInput Up

But if i make a click, i have not any output, i am not marking NOTHING as handled, so i don't understand why my proccesor is'nt listening mouse events.

Godot version 3.2.3
in Engine by (12 points)

Do you have a control node or something else catching the event? What's your scene layout?

No, i did move every input listener to a unique controller (master node in one scene), but i have buttons.
My tree is:

- Runner (Node)
---- Background (Linked, no have listeners)
----GUI (Linked, Node, have 2 buttons)
---- Character (Linked, no have listener)

My problem starts with the pause button, my character jump with any click, and when i push pause he was jumping, now, with unhandledinput the touch or click isn't listening

Does your GUI cover the entire screen? It might be taking the click event that way. You'll need to set the mouse filter to ignore if that's the case.

Effectively. My UI Control Main node is fullscreen, i setup his mouse property to ignore and now my buttons works propertly and my character jump perfectly. Very thanks!!

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.