Custom UI control reparenting childs not working in editor but does in-game

Godot Version



I am trying to create a custom window panel, basically, juste a header and a content, and be able to reuse this “template” for all windows in my game.
Currently, I managed to create my “window template” and retarget the childs to the PanelContainer :

Custom UI control structure:

  • [PanelContainer] Window
    • [VBoxContainer] Content
      • [HBoxContainer] WindowHeader
        • [PanelContainer] HeaderContainer
          • [Label] HeaderLabel
      • [PanelContainer] PanelContainer

I am using a simple C# script to reparent all the childs:

public partial class Window : PanelContainer
	public override void _Ready()
		var content = GetNode<PanelContainer>("Content/PanelContainer");
		var children = GetChildren().Slice(1); // We get all the children but we skip the first one: "Container"

		foreach (var child in children)

The problem I am facing now, is that in the editor I don’t get the correct result. The Label is still parented to the Window node:

But when I run the game, it appears at the right place.

How can I manage to get the same result on both editor and in-game ?

PS: sorry I cannot put more than one image on the post…

At the moment, what I am trying to achieve is not possible. I must use the Editable Children option instead.

But, there is a proposal on godot-proposals repository which could solve my issue: Add ability to flag a "Node Slot" for instanced scenes · Issue #5475 · godotengine/godot-proposals · GitHub

Here is the PR : Expose nodes inside of an instantiated scene instead of just "Editable Children" by Yahkub-R · Pull Request #84018 · godotengine/godot · GitHub