How do you change Button sizes in a Box Container node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By funlamb
:warning: Old Version Published before Godot 3 was released.

I’m trying to show that a button is selected by making it a bit bigger then all the other buttons in this VBoxContainer. I’m using an AnimationPlayer to make the buttons slide in from the right.

I’ve tried:

func _ready():
    # get children
    list_buttons = get_children() # this gets the children so I can change their size
    list_buttons[1].set_scale(Vector2(200, 100))
    list_buttons[1].set_size(Vector2(200, 100))
    list_buttons[1].set_pos(Vector2(200, 100))
    #none of these set functions do the trick 
    pass

Am I missing some kind of update that I need to be doing?

Not sure if it is the problem or not, but your setting the scale to 200 by 100. That is 200 by 100 times as big. Try setting scale to (1,1).

D | 2017-03-11 21:04

I did (1.5, 1.5) and it didn’t make it 50% bigger.

funlamb | 2017-03-12 01:23

:bust_in_silhouette: Reply From: funlamb

So it needs to be done in func _process(delta):

func _ready():
    # get children
    list_buttons = get_children()
    list_buttons[0].set_scale(Vector2(1.5, 1.5)) # doesn't work here
    set_process(true)

func _process(delta):
    list_buttons[0].set_scale(Vector2(1.5, 1.5)) # works here

When using Kinematic2D node you can set it’s scale, pos, or rotation in func _ready() you cannot seem to do that with a button node. I don’t know if I’m doing something wrong but using func _process(delta) seemed to work.

:bust_in_silhouette: Reply From: funlamb

I have found that I’m an idiot once again.

You can change the size of nodes in various ways:

set_size(Vector2 (200, 100)) # Change size manually 
set_scale (Vector2(1.5, 1.5)) # Make 50% bigger

When using these you can use them anywhere you like.

func _process(delta):
func _ready():

But if your node is being used in the AnimationPlayer your changes will not be kept when using func _ready(): because your animationPlayer will just use all your keyframes for the nodes you are using. We will need to use func _process(delta): or change the size somewhere after the animation is over.