Three screens of my game looked right on the desktop and on every headless test, then came out broken on the first Android install: the top bar was cut to a stub and the right-hand shop panel was nowhere on screen. Nothing in the logs. The scenes had been written by hand, and the instanced sub-scenes were missing one line.
TL;DR — when a .tscn instances a Control scene under a Control parent, the instance node needs layout_mode = 1. Without it the node is in « position » mode; the desktop run happens to honour the sub-scene’s own anchors, the exported build does not, and anchored panels land at the wrong place or outside the viewport.
The setup
An Android game in Godot 4.7.1 whose UI is Control-based. Common pieces are separate scenes — a TopBar (a full-width 88 px PanelContainer anchored to the top) and a ShopPanel (anchored to the right edge, 300 px wide) — instanced into screen scenes. All .tscn files were written by hand, not through the editor, which is why the line the editor always writes was never there:
[node name="TopBar" parent="." instance=ExtResource("2")]
[node name="ShopPanel" parent="." instance=ExtResource("3")]
The sub-scenes themselves declare their anchors (anchors_preset, anchor_right = 1.0, offset_bottom = 88.0, and so on).
What I expected
The instanced root carries its anchors inside the sub-scene, so I expected the parent scene to inherit them; the editor run showed exactly that, and a GUT test suite that instantiates every screen passed. I took the desktop result as proof of the layout.
What actually happens
On the emulator, the base-building screen showed the top bar truncated to a small block in the corner and no shop column at all; the campaign and army lists were cut the same way. Screenshots from adb exec-out screencap made it obvious, but no test could have: in headless mode there is no window, and on the desktop the layout was correct.

The fix
One property on every instanced Control that sits under a Control parent:
[node name="TopBar" parent="." instance=ExtResource("2")]
layout_mode = 1
[node name="ShopPanel" parent="." instance=ExtResource("3")]
layout_mode = 1
[node name="BuildingInfo" parent="." instance=ExtResource("4")]
layout_mode = 1
1 is the anchors mode (0 is position, 2 is container, 3 is uncontrolled). Instances placed under a CanvasLayer do not need it — a CanvasLayer is not a Control, so the instance is a top-level Control and keeps its own anchors.
A quick way to find the missing lines in a hand-written project:
grep -n 'instance=ExtResource' -A1 --include='*.tscn' -r . \
| grep -B1 -v 'layout_mode' | grep 'instance='
Why it works
Since Godot 4.0 a Control’s layout_mode decides which set of properties drives its rect: position/size, anchors/offsets, or the parent container. The editor writes it for every Control it saves, so scenes made in the editor never hit this. A hand-written node without the property gets the default 0. When the packed scene is instantiated, the sub-scene’s root brings its anchor values, but in position mode those anchors are not the authority; the node is placed by position and size instead, and both are effectively zero for an instance that never had them set. Whether the anchors still « appear » to apply then depends on the order in which the instance’s properties are restored and the parent’s first layout pass runs — the editor-driven desktop run resolved it one way, the exported build the other. Setting layout_mode = 1 removes the ambiguity: the anchors are the authority in both.
What I did not test
I observed the wrong layout on an Android 14 x86_64 emulator with the GL Compatibility renderer, and the correct one on Linux desktop; I did not trace the exact restore order in the engine, so « position mode falls back to zero size » is my reading of the class reference plus the observed result, not a source-level proof. Scenes saved by the editor are unaffected because the editor always writes the property.
Facts
context: Godot 4.7.1, hand-written .tscn instancing Control sub-scenes under a Control parent
problem: anchored sub-scenes (top bar, side panel) render truncated or off-screen only in the exported Android build
solution: add layout_mode = 1 on each instanced Control node in the parent .tscn
verified_on: 2026-09-12
applies_to: Godot 4.x .tscn written or generated outside the editor
does_not_apply_to: scenes saved by the editor (it writes layout_mode); instances under a CanvasLayer