fix(client): resolve TabContainer via find_child instead of @onready

@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 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 18:51:09 +01:00
co-authored by Claude Opus 4.6
parent a2ef1c34cb
commit 307a221527
+7 -1
View File
@@ -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