0 votes

I can create a node on its own with the following code:

func _unhandled_input(event: InputEvent) -> void:
    if event is InputEventMouseMotion:
        print("mouse moved")

and have it work and giving me the following output when I move the mouse:

mouse moved
(-1238.743164, -463.655518)
mouse moved
(-1238.743164, -463.655518)
mouse moved
(-1238.743164, -463.655518)
mouse moved
(-2783.995117, -1634.93042)

but when I paste this exact same code into my player script, it only triggers when I run the player scene on it's own with F6, but running the game with the main scene (F5) with the player in it it never triggers. I have already checked if I have used the function "set_input_as_handled()" somewhere in another script with Ctrl+Shift+F, and there is none.

Any help much appreciated. Thank you.

Godot version 3.3.2.
in Engine by (12 points)

Could there be some node consuming the mouse movement? If there are any Control nodes in the scene, check their "Mouse" property and see whether the property is set to "Ignore" or "Pass".

You are right! When I delete my UI it is working! So now I just need to isolate which specific node it is. Thank you!

If you have many nodes which could consume the input, you can go to Debugger pane -> Misc. -> Clicked Control to see which node consumed the mouse input last.

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.