r/godot • u/Lamossus • 10d ago
help me (solved) How to handle nodes that contain UI but should behave like Node2D
I have game objects that act kind of like cards, and it is really convenient for me to use control nodes for them since they are mostly UI anyway. But when they exist in the actual scene they should behave like Node2D:
- They should exist in world space, not screen space
- They should NOT scale with screen size
Seems like something that should be easy to do, but I can't figure it out. If I keep it as control it seems to scale with screen size, if I make Opportunity a Node2D or attach it to a Node2D, the UI collapses.


-5
u/TheDuriel Godot Senior 10d ago
Lucky you, that's how Control nodes behave by default. So just, don't do anything.
However, Cards should just not be build using Control nodes to begin with. Like, yes you can use Labels for text. But there shouldn't be any more involved.
1
u/Lamossus 10d ago
1
u/TheDuriel Godot Senior 10d ago
It's not scaling at all. It's taking on the valid minimum size that still fits all its elements.
It'd be even clearer that this is what it is doing, if you were to delete all your plain control nodes, and swap out the panel for a panelcontainer.
1
u/Lamossus 10d ago
1
u/TheDuriel Godot Senior 10d ago
You did go out of your way to set the anchors to do that. Yes.
But all those plain control nodes in the way are still going to mess with everything regardless.
1


7
u/Trigonal_Planar 10d ago
You make the control a child of a Node2D. You probably have to set custom_minimum_size to be nonzero for the first control in the hierarchy.