What am I doing wrong here?
private PackedScene healthIconResource = (PackedScene)ResourceLoader.Load("res://prefabs/UI/healthIcon.tscn");
private HBoxContainer healthContainer;
private void SetupHealth() {
for (int i = 0; i < health; i++) {
GD.Print("Create health sprite");
var healthIcon = healthIconResource.Instantiate();
healthContainer.AddChild(healthIcon);
}
}
Yet the result is only 2 icons and one of them misplaced! (see image)