Label Visibility Issues

Godot Version

Godot 4.4.1

Question

So when I have a label that I call FloatingTextComponent that I instantiate in another scene. When I instance and add it to the tree immediately, it appears as expected and I can modify the text and colors afterwards. However, in doing this some of the properties of the label is not properly recorded, such as the new x size of the label as a result of changing the text. So I change the text and get the proper size by setting the label properties prior to adding the label to the tree with add_child(). But this results in the label not appearing at all regardless of what property of the label is changed. Anyone know why this occurs?

This results in the label not appearing

var label : FloatingTextComponent = load(path).instantiate() 
label.text = "test" 
add_child(label) 

And this results in the label appearing but I cant get the proper size

var label : FloatingTextComponent = load(path).instantiate() 
add_child(label) 
label.text = "test" 

Oh and my FloatingTextComponent is essentially just a scene that is just a label and I renamed it to FloatingTextComponent with class_name. I do some more background logic but that is not needed in this scenario.

Figured it out, I had to wait a frame for the game to update information before adding the child

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.