0 votes

When I place ColorRect (or some another kind of control node) inside the MarginContainer, I have this strange margin on the left side: child node's margin always become 8.

node tree
margin 8

Maybe, I don't understand usage of this type of container. Actually, I don't see the difference between functionality of MarginContainer and simple Container.
Please, explain me this kind of behavior.

Thank you.

asked Jul 12, 2018 in Engine by heleg (19 points)

2 Answers

+1 vote
Best answer

Margin container has custom parameters, for top, left, right, and bottom margins, that take an int value that represents the distance in pixels the children are from the container's borders.
Don't confuse it with the common margins that every control has, they are at the end of the inspector.

answered Jul 18, 2018 by hinasis (222 points)
selected Jul 22, 2018 by heleg

Thank you very much for explanation.

This vague description just confuses me more.

Simple margin container. Adds a left margin to anything contained.

Should we contribute a better explanation? What do you think?

+1 vote

Go in your margin container custon constant field and check "margin left"
I don't know why there is this weird space but this should do the trick.

answered Jul 17, 2018 by tomandrieu (33 points)

Thank you for advice.

Margin disappeared when I set it to zero. Is it a bug?


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.