|Topic was automatically imported from the old Question2Answer platform.
I have a TextureButton with texture of size 32x32 My goal is to get the following behavior: the button stays on top of the screen and always has dimensions of 32x32 pixels (i.e. it doesn’t scale). How do I achieve that with control nodes?
Currently I tried the following: I put it in the VBoxContainer as the first element, set it’s stretch mode to Keep, size flags to Fill in both directions. My Window settings are Mode: 2d, Aspect: expand. It behaves as I want when I make the window larger (buttons stays 32x32), however when I make the window smaller it starts to scale down. What am I doing wrong?
Inspector tab of the
TextureButton, go to
Control > Rect > Min Size.
Well, it doesn’t help. I guess it is because texture size doesn’t change (and stays exactly at the native size), but it visually scales because coordinate system scales.
I actually figured out through trial and error that setting Window stretch mode to “disabled” in Project Settings achieves the behavior I want. I probably need a better understanding of “2d” and “disabled” stretch modes and the use-cases for both of them…
merlin_ua | 2018-02-21 06:49
The only way seems to be setting the
Stretch Mode to
disabled, which obviously disable the stretching or scaling of the button.
Also, I found this docs page about Stretch Settings.
Dlean Jeans | 2018-02-21 13:50