Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | vonflyhighace2 | |
Old Version | Published before Godot 3 was released. |
is it possible to scale a node that’s inside a box container such as a button?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | vonflyhighace2 | |
Old Version | Published before Godot 3 was released. |
is it possible to scale a node that’s inside a box container such as a button?
Reply From: | kubecz3k |
You can change scale
property for the content of VBoxContainer
/HBoxContainer
, but the items will overlap each other. The best way would be to modify size of the content with Min Size
property in editor. From code it’s set_custom_minimum_size(Vect2 size)
method.
If you really want to work with scale you can simulate this by multiplying initial size with factor. For example:
#inside Control Node (lets say a button)
var initSize;
func _ready():
initSize = get_size();
func scaleMinSize(inScaleFactor = 1.0):
set_custom_minimum_size(initSize*inScaleFactor);