rect_scale stuck at (1,1)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GForce Productions

Hi, I am encountering the following issue and I am going insane :frowning:

In short:
I have a scene, which is just one button, that I use as a template, so I can instantiate that scene many times.
In that scene, I set the scale of the button to (0.64, 0.64)
Then in my main scene, I create the button using:

var remove_button_object = preload("res://templates/Remove_from_queue_button_template.tscn").instance()


remove_button_object.i_in_queue = i

remove_button_object.connect("pressed_remove_from_queue", self, "_on_Remove_from_Queue_pressed")

get_node(add_to_node_path + "2").add_child(remove_button_object)

I check after every line, and every time it returns (0.64, 0.64).
However, it always shows up with scale (1,1) in reality.

Also, inside _process() of the template scene I also make the print, and there it always returns (1,1).
The strange thing is that it used to work, and all of a sudden after running a few times it has this strange behaviour.

What can I be missing?

After more trying, it seems that as soon as I add it as child to a ScrollContainer, the problem appears.
If I add the button instance as a child to the parent of the ScrollContainer, it functions normally.

This is also strange, because I do the exact same thing (adding to ScrollContainer) somewhere else in the code and there it works.

GForce Productions | 2021-08-29 15:12

:bust_in_silhouette: Reply From: GForce Productions

Ok, so apparently scale does not work if it is directly inside a ScrollContainer/HBoxContainer/VBoxContainer