From 307a221527f08f7e8eeb4901edf5f43207931f37 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 22 Mar 2026 18:51:09 +0100 Subject: [PATCH] fix(client): resolve TabContainer via find_child instead of @onready MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @onready path resolution fails when the scene is instantiated as a child of MainMenu — the node path is valid in the .tscn but the layout hierarchy breaks during child instantiation in Godot 4.6. Using find_child() is more robust for scenes that are dynamically added to another scene's tree. Co-Authored-By: Claude Opus 4.6 --- client/ui/character_creation.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/ui/character_creation.gd b/client/ui/character_creation.gd index 6e9da693a..bdde8be02 100644 --- a/client/ui/character_creation.gd +++ b/client/ui/character_creation.gd @@ -112,7 +112,7 @@ const RECENT_SLOTS := 9 @onready var _rotate_left_btn: Button = $Layout/PreviewPanel/PreviewOverlay/RotateButtons/RotateLeftBtn @onready var _rotate_right_btn: Button = $Layout/PreviewPanel/PreviewOverlay/RotateButtons/RotateRightBtn @onready var _cam_angle_btn: Button = $Layout/PreviewPanel/PreviewOverlay/CamAngleBtn -@onready var _tab_container: TabContainer = $Layout/TabPanel/TabContainer +var _tab_container: TabContainer = null # resolved in _ready() — @onready path fails when instantiated as child @onready var _footer_back: Button = $Footer/BackBtn @onready var _footer_randomize: Button = $Footer/RandomizeBtn @onready var _footer_start: Button = $Footer/StartBtn @@ -195,6 +195,12 @@ var _tab_grids: Array[GridContainer] = [null, null, null, null, null] # ============================================================================= func _ready() -> void: + # Resolve TabContainer — @onready path fails when scene is instantiated as child of MainMenu + _tab_container = find_child("TabContainer", true, false) as TabContainer + if _tab_container == null: + push_error("CharacterCreation: TabContainer not found in scene tree") + return + _descriptor = CharacterVisualDescriptor.new() _descriptor.body_type = CharacterVisualDescriptor.BodyType.AVERAGE_M _descriptor.skin_tone = 2 # light_olive — readable middle-ground default