Topic was automatically imported from the old Question2Answer platform.
Asked By
pferft
Hi everyone,
I switch off input for a button while it animates using "get_tree().get_root().set_disable_input(true)". As this unfortunately switches off input not only for the button-node but for the whole scene, is there a way to confine this on the node alone?
I tried "get_node("ButtonArea2D").set_disable_input(true)" but that leads to “Invalid call. Nonexistent function ‘set_disable_input’ in base ‘Area2D’.”
Any suggestions?
Did you try to disable input in the properties of the button?
My bad, it’s not a “button” in that sense, I should have elaborated that earlier. It’s a self-made “button” (Area2D - CollisionShape2D) including several functions like “_on_timer_timeout” and “_on_Area2D_mouse_exited” and alike. There are things happening within each of them like animations including yields, and during those I’d like to have any input disabled. So I guess “button.disabled” won’t work in this case.
I’ve been looking into “input_pickable” before, because I think that might be what I need here. Probably a typical beginner-issue, I just couldn’t find out how to build it into my script! (I, the brginner, sometimes stumble over things, like in the documents, that look exactly like what I need, but I have no idea yet how to implement them. If only there were little examples shown in those places… I’m certain most beginners know that feeling.)
Could you tell me how I can actually “use” input_pickable?
Thanks for your help!
THE BIG EDIT:
I just learned: get_node("your_area2D").input_pickable = false does the trick!