Chaning multiple Labels with a for-loop

Godot Version

4.5

Question

How to edit different label's text with a for loop

I have 5 labels that describe skills info (name, level, etc.), each label shows all the info of one skill. I want to for loop to loop through the labels, changing the text with their respective information:

Basically, what I was thinking was adding the variables of each label into a list, so that i could loop through it to change the text.

FYI skills hub is a 2d array with all the information (but thats not the issue here) and the error it’s giving me is saying: Invalid assignment of property or key ‘text’ with value of type ‘String’ on a base object of type ‘Nil’.

How can I achieve this? Thanks!!

@onready var labelss...

By the way, you can assign margins in the stylebox of the PanelContainer, you don’t need to chain MarginContainer and PanelContainer together.
As a matter of fact, I never use MarginContainer personally, it’s the most useless node imho. I always use just the PanelContainer, it’s more versatile.

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