Why did switching await from ready to the tree_entered signal work?

Godot Version

4.3 Stable Mono

Question

I spent a long time trying to figure out why I couldn’t see the text in my labels.

I made a Segment, tool-script, node that extends TextureButton. It has a CenteredLabel, tool-script, node as a child, which is just a Label inside of a CenterContainer. I loaded Segment positions and it’s CenteredLabel’s text property data from file, and used it to instantiate Segments from a PackedScene.

I fixed it by switching from ‘await ready’ to ‘await tree_entered’ in my Segment node’s script.

I would like to know why this worked. I thought the ready signal was only emitted in the ready function, which is only called when a node enters the scene tree, not when instantiate() is called on it’s PackedScene.

I’ve noticed that it doesn’t matter if the CenteredLabel node’s script has ‘await ready’ or ‘await tree_entered’ before assigning the text property of it’s Label node child.

@export var moniker: String : 
	## Sets the child Label's text property. 
	set(arg): 
		if not Engine.is_editor_hint(): 
			await tree_entered  # previously was 'await ready'
		$CenteredLabel.text = arg 
	get():
		return $CenteredLabel.text