+3 votes

I have a box container with buttons as child nodes. The buttons are larger than the container so I tried scaling them down but the buttons do not respect the scale value. Is there a way to scale buttons inside a container?

in Engine by (271 points)

Not sure I understand the problem you're describing. What kind of container are you using? The plain one I think doesn't enforce any sizing.

Have you tried using a ButtonGroup, HBox, or VBox?

I've tried everything from buttonGroups to gridContainer. The base Container class is really nothing but a disguised control node. The problem is that the child nodes scale is linked to the parents scale. Try changing the child's scale will only result in it being overridden by the parents scale. the only way to change the scale of the child is to change the parent container scale which will then change all child node. That is a problem if you only want to change a single child node.

If that's your problem I would say turn off the size flags. (The horizontal/vertical fills and expands.) Then set the minimum size property to scale it up to what you'd want.

Unfortunately that was one of the first things I tried. The problem with that it only changes the size {width/height} of the node not its scale. That would be good if you have say a texture button/Frame you wanted to resize. But if that texture button had any children then they would not be resized causing a weird issue and trying to resize all child nodes is not practical when on the other hand they scale accordingly. I find that only the container nodes have this issue.

You may need need to set custom minimum size and try with the various size flags and values of controls.

I've had a lot of problems with scroll container because sets everything to minimum size and reset all resizes.

There is no current option to set a minimum scale size for nodes like you can do for its size property. That's the problem I have. My node has child nodes that need to be resized accordingly with the parent node. Just resizing the parent does nothing for the child nodes and trying to manually resize all child node proportionally to the parent is not practical. I can achieve this using every other node that's not apart of the container class. The reason I wanted to use one of the containers is that they have organizational properties build-in to help with child nodes. This lead me to believe the container class is fundamentally broken.

Actually You would need a Maximum property so that the node knows not to go over the set parameter since it will default to the parents scale.

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 Frequently asked questions and 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.