Quick answer: Anchors only work when the parent is a plain Control (or root Viewport). Container parents override child anchors. Set anchors_preset to Full Rect on the child, ensure the parent is a Control, and pick a project Stretch Mode that matches your design.

Here is how to fix Godot Control nodes whose anchors do not adjust when the window changes size. Your HUD looks correct at the design resolution but cuts off in the corner at any other size. Either the anchors are wrong, or a Container parent is overriding them, or the project’s viewport stretch mode is fighting your layout.

The Symptom

Drag the window edge to resize. The HUD does not adjust — it stays anchored to the top-left, leaving the rest of the window blank or showing scaled-up content. Or the entire UI compresses uniformly while you wanted only certain elements to stretch.

What Causes This

Anchors not full rect. Default anchors are 0,0 (single point at top-left). The control sits there and never resizes. Set Full Rect for stretch behavior.

Container parent overrides anchors. If a Control is inside an HBoxContainer, VBoxContainer, GridContainer, etc., the Container sets the child’s position and size each frame. Anchors are ignored.

Wrong stretch mode. Project Settings → Display → Window → Stretch determines how the viewport handles window size changes. Mode = viewport scales the whole UI; mode = disabled lets anchors handle it.

Custom minimum size pinning. If a control has a large custom_minimum_size, it cannot shrink, regardless of anchors.

The Fix

Step 1: Set anchors via the editor preset. Select the Control. In the toolbar, click Anchors and pick Full Rect (or Wide Rect, Top Right, etc., depending on intent). The anchors update to match.

Step 2: Pick the right Container vs Control parent.

# For a HUD that resizes with window:
Root (CanvasLayer)
  HUD (Control)              # Full Rect anchors
    HealthBar (TextureProgress)  # Anchored top-left
    Minimap (Sprite2D)             # Anchored top-right

# For a list of items:
Root (CanvasLayer)
  Inventory (VBoxContainer)  # Container manages children
    Item1 (Button)
    Item2 (Button)

Use Containers for laid-out groups (lists, grids). Use plain Control for hand-placed elements that should anchor to viewport edges.

Step 3: Configure project Stretch Mode.

# Project Settings -> Display -> Window -> Stretch
Mode    = canvas_items   # Recommended for most 2D games
Aspect  = keep            # Maintain aspect ratio
Scale   = 1.0

canvas_items mode renders 2D content at the actual window resolution while maintaining the design viewport coordinates. Anchors then stretch to match the actual window. For pixel-art games, prefer viewport mode with a low base resolution.

Step 4: Watch for custom_minimum_size. If the control will not shrink below a value, that is your minimum size. Reset to 0 unless you have a specific minimum.

Step 5: Connect to size_changed for runtime tweaks.

extends Control

func _ready():
    get_viewport().size_changed.connect(_on_window_resized)

func _on_window_resized():
    # Custom adjustments not handled by anchors
    $Sidebar.custom_minimum_size.x = get_viewport_rect().size.x * 0.2

Common Layout Patterns

Top bar: anchors_preset = Top Wide. Stretches across the top, fixed height.

Bottom HUD: anchors_preset = Bottom Wide. Stretches across the bottom.

Centered modal: anchors_preset = Center. Stays centered as window resizes.

Sidebar: anchors_preset = Right Wide or Left Wide. Stretches vertically, fixed width.

Understanding the issue

This bug class falls into a pattern that's worth understanding beyond the specific case. In Godot Engine, the underlying behavior is shaped by how the engine layers its abstractions - the public API you call, the runtime systems that respond, and the platform-specific implementations underneath. A bug at any layer can produce symptoms that look like they originate at a different layer. Triaging effectively means recognizing which layer the symptom belongs to, even when the gameplay code is what's visible.

The specific bug described above is the kind that surfaces during integration rather than unit testing. It depends on a combination of factors: the asset configuration, the runtime state, the platform's specific behavior. In isolation, each piece looks correct; in combination, the bug emerges. This is why thorough integration testing - playing the actual game in realistic conditions - catches things that automated tests miss.

Why this happens

Bugs of this class are particularly easy to ship past internal QA because they often depend on specific runtime conditions - hardware combinations, network states, or asset configurations that QA didn't reproduce. Players hit them in the wild, file reports that are hard to repro, and the bug accumulates negative reviews while engineering tries to recreate the failure mode.

At the engine level, the behavior comes from a deliberate design decision in Godot. The engine team chose a particular trade-off - usually performance versus convenience, or generality versus specificity - and that trade-off has consequences when you push against it. Understanding the trade-off is what turns 'this bug is mysterious' into 'this bug is the expected consequence of this design'.

Verifying the fix

For shipping games, the safest verification is a staged rollout. Apply the fix to 1% of players for 24 hours; watch the affected metric; expand if green. Skipping the staged rollout means the verification is the entire player base, which is too high a stakes for most fixes.

Reproducibility is the prerequisite for verification. If you can't reliably reproduce the bug pre-fix, you can't reliably verify it post-fix. Spend time getting a clean reproduction before you write any fix code. The fix is fast once you understand the reproduction; the reproduction is the slow part.

Variations to watch for

There's almost always a less obvious case where the same problem applies. The reported case is the one a player hit; the related cases hide because they're rarer or affect fewer players. After fixing the reported case, search the codebase for the pattern - one fix often unlocks several.

Adjacent bugs often share a root cause. After fixing the case you've found, spend an hour searching the codebase for similar patterns. What's the same call with different arguments? The same data flow with a different entity type? The same lifecycle issue in a sibling system? Each match is a candidate for the same fix, or a related fix that prevents future bugs of the same class.

In production

In shipping builds, this issue may interact with other production-only behavior. Stripping, encryption, asset bundling, and platform-specific code paths can each modify the symptoms. When players report a related issue, capture build SHA, platform, and any feature flags - those three fields cover most of the production-only variations.

When triaging a similar issue in production, prioritize gathering data over hypothesizing causes. A player report describes a symptom; what you need is a build SHA, a session timestamp, and ideally a screen recording or session replay. With those, the bug becomes tractable. Without them, you're guessing at hypothetical reproductions that may not match what the player actually hit.

Performance considerations

If this issue manifests under high load (many actors, many particles, many network connections), profile the post-fix code path with realistic counts. The original cost was a bug; the new cost is real work, and real work has a budget.

Diagnostic approach

The diagnostic tools available depend on your engine and platform. Use the engine's native profilers and debug overlays before reaching for external tools. The native tools have context that external tools lack - they know which subsystem owns the code, which assets are loaded, and what state the engine is in.

For Godot-specific diagnostics, the editor's profiler is the canonical starting point. Capture a representative frame with the symptom present; compare against a frame without the symptom; the diff often points directly at the cause. If the symptom is non-deterministic, capture multiple frames and look for the pattern - the cause is usually a state transition or a specific input value rather than a continuous effect.

Tooling and ecosystem

The tooling around this bug class matters as much as the fix itself. Good logging, accessible profilers, and clear error messages turn 30-minute investigations into 5-minute ones. If your project doesn't have visibility into this code path, the first fix should add the visibility - the second fix uses it.

Within Godot, the relevant diagnostic surfaces include the standard frame debugger, memory profiler, and engine-specific debug overlays. Each one shows a different facet of what's happening. The frame debugger reveals draw call ordering and state transitions; the memory profiler shows allocation patterns; the debug overlay reveals per-system state. Bugs that resist one tool usually surrender to another - the trick is knowing which tool to reach for first.

Edge cases and pitfalls

Boundary conditions deserve specific testing attention. What happens when the input is zero, maximum, negative, or NaN? What happens at the start of a session vs hours in? What happens at the boundary between two systems handling the same data? These are where bugs hide and where regression tests are most valuable.

When writing a regression test for this fix, focus on the boundary conditions that surfaced the original bug. Tests that exercise the happy path catch obvious regressions; tests that exercise the boundary catch the subtler regressions that look like new bugs but are really the original returning. The latter are the tests that earn their keep over the long life of the project.

Team communication

Document the fix and its rationale in the commit message or attached engineering doc. Future engineers will encounter related issues; the rationale tells them whether your fix is reusable or specific to the case at hand. Without rationale, the fix gets reverted or copied incorrectly.

If this fix touches a system several engineers work in, a short writeup in the team's engineering channel helps. Not a full design doc - a paragraph explaining what was wrong, what's fixed, and what to watch for. Future engineers encountering similar symptoms will search for the fix; making it findable is a small investment that pays back later.

“Anchors describe how a Control follows its parent. Containers override anchors. Pick the right tool for each part of the UI.”

Related Issues

For CanvasLayer behavior, see CanvasLayer Follow Viewport. For Camera2D smoothing, see Camera2D Smoothing Jitter.

Anchors preset for stretch. Control parent for anchors to work. canvas_items for most projects.