Code like if(event is InputEventMouseButton): checks for a once-only event upon pressed or released. I want continuous polling of a mouse button so that as long as the button is being held down, I'm getting executing some code.

I can set a flag upon pressed, and unset it upon release but it seems to me like there should be a way to poll the buttons.

If you have the mouse button bound to a action, you can use Input.is_action_pressed and that will return true as long as the mouse button is held down. I did a quick test, and the following works for me, with Mouse_Action having mouse button 0 as the only input bound, and with the code in _physics_process:

if Input.is_action_pressed("Mouse_Action"): print ("DOWN") else: print ("UP")

Ah, thanks TwistedTwigleg, I see my mistake, I was trying calls in _input event like this: func _input(event): if (event.is_action_pressed("left_mouse")): and only getting called once when pressing and once when released.

4 years later