0 votes

Hello, I have a problem: When I use my panning/dragging the camera around function it works fine. But if my cursor is hovering over any button in that scene it no longer works.

I have tried moving the nodes around in my scene but it doesn't help. I don't know what else should I try. Please help.

Here is the code for the dragging/panning:

func _unhandled_input(event: InputEvent) -> void:

    if event is InputEventMouseMotion:
        if event.button_mask == BUTTON_MASK_MIDDLE:
            position -= event.relative * zoom
Godot version 3.5
in Engine by (17 points)

you already answered.
mouse works in blank areas of the screen. When it hovers over another node, the function comes to that node.

sorry i use translation
English is not my native language.

1 Answer

0 votes
Best answer

"unhandled" input only detects input that is not being handled by other nodes. The buttons are handling the input. Use _input instead.

by (8,526 points)
selected by

Thank you. In the meantime I made a workaround using Area2D and CollisionPolygon2D. I tried changing _unhandled_input to _input tho and it works as well. It is better than the workaround I did so I'll change it.

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.