0 votes

I'm currently building a top down world, and I thought it would be a nice feature to drag and drop buildings from within a GUI onto a tilemap. However it appears that whenever my mouse is within a control, be it the general class, or any variant, It seems to block onArea2Dinputevents. On the face of things it kinda makes sense, Your "GUI" should be in front of everything, chaos would reign if you were also interacting with a bunch of stuff you couldn't even see behind the buttons you're clicking. But I would've thought layers would take care of that, even when I fill a control container with nodes, I don't seem to be able to interact with anything but control objects. This seems to completely throw out any possibility of... let's say drag something out of an inventory and throw it on the floor.

Is there any way to make something like this work? Or should these two systems never mix?

in Engine by (82 points)

1 Answer

+1 vote
Best answer

For GUI elements there's a mouse_filter property which affects a mouse capture mode for every control.

by (1,438 points)
selected by

Ewww, after tinkering around with that I can definitely verify that setting it to ignore will allow you to interact with area2D, but it seems like that field solely acts on what control fields are overlapping the area2D you're trying to click on.

What I'm trying to do is if I have a tree like this

-ColorRect
--- scroll container
------ container
-------- building (Node I want to drag out of the container)

I'm looking for a way to interact with "building" but not with any other buildings that may be outside of that tree.

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.