godotengine / godotengine/godot
Setting scale of a control node inside of a container doesn't work if set immediately
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in v4.4.dev3.mono.official
### System information
v4.4.dev3.mono.official [f4af8201b]
### Issue description
When control node is contained by a container (eg. `VBoxContainer`) and its scale is set immediately after node's creation, the scale value doesn't have any effect. If the scale is set afterwards or it is set using a tween with 0 second duration, the scale works as expected.
### Steps to reproduce
Scene:

Code:
```gdscript
extends Node2D
@onready var label: Label = $VBoxContainer/Label
@onready var v_box_container: VBoxContainer = $VBoxContainer
var label_2
func _ready() -> void:
# this doesn't work:
label.scale = Vector2(0.4, 1.0)
label_2 = Label.new()
v_box_container.add_child(label_2)
label_2.text = "Another label with some text"
# this doesn't work:
label_2.scale = Vector2(1.0, 2.0)
# setting scale using a tween with zero duration works:
#create_tween().tween_property(label, "scale", Vector2(0.4, 1.0), 0.0)
#create_tween().tween_property(label_2, "scale", Vector2(1.0, 2.0), 0.0)
func _on_button_pressed() -> void:
# this works:
label.scale = Vector2(0.4, 1.0)
label_2.scale = Vector2(1.0, 2.0)
```
If the button is clicked or if the two `create_tween()` lines are uncommented, scales are working as expected.
### Minimal reproduction project (MRP)
[scale_test.zip](https://github.com/user-attachments/files/17376934/scale_test.zip)
Contributor guide
Research direction
Start with the linked scale_test.zip minimal reproduction and follow the _ready() assignments for the existing Label and dynamically added Label inside the VBoxContainer. Compare those results with the button callback and zero-duration tween cases; done means both initial scale assignments visibly take effect without requiring a later callback or tween.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100