I am trying the generate a list of buttons in my code and display them in a VBoxContainer, but the buttons get resized to the default size of 20, not the size I give them. I have looked at other similar questions and they say to use the rect_min_size
function but I get an error saying Invalid call. Nonexistent function 'rect_min_size' in base 'Button'
.
My code so far:
extends VBoxContainer
func _ready():
for i in range(Stats.button_list.size()):
var button = Button.new()
button.set_size(Vector2(125, 40))
button.rect_min_size(Vector2(0, 40))
button.text = Stats.button_list[i]
button.show()
add_child(button)