Given the following scene layout:
GameNode
\--- MarginContainer
\--- VBoxContainer
\--- Control1
\--- Control2
If MarginContainer
sets a margin of say 20px
and all children have their size flags set to expand|fill
, I would expect that they all receive a 20 pixel margin, but they don't. Only the direct children of MarginContainer
do, in this case the VBoxContainer
. However, its children have their margins reset to 0.
I find this behavior surprising; I would expect that margins apply transitively to all child nodes of a MarginContainer
and don't suddenly stop applying. Shouldn't the VBoxContainer's children expand only to fill their direct parent?
A detail I omitted above is that the VBoxContainer
and its children are stored in a separate scene. Does this have any impact on margins applied by its parent when they are in different scenes?
Here are two screenshots of the remote node data that show the problem. First, the parent container with the expected margin and rect position of 20,20
:

And its first child, which suddenly has no margins anymore:

What am I missing here?