0 votes

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)
Godot version 3.4.4
in Engine by (15 points)

1 Answer

+1 vote
Best answer

rectminsize is a property, not a function
does setting the value work

button.rect_min_size = Vector2(0, 40)
by (103 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.