Texture buttons, resizing text

Godot Version

4.3rc3

Question

According to some video, the best buttons are TextureButtons but they for some reason don’t support text, so the video said you should add labels to them (TextureButton is parent to Label). That feels ghetto but whatever. The problem: i’m now internationalizing my game and longer text causes the Label to grow but not the TextureButton, so it looks dumb.

Setup: VBox --> TextureButton --> Label
image image

![image|622x500]

Regular buttons grow, although at different sizes, which looks awful. Putting them in a VBox fixes that for normal buttons but not TextureButtons.

Not sure what the right thing to do is. Here are thoughts:

  1. Find a way to make TextureButtons grow when their child Label does.
  2. Learn that TextureButtons secretly have a text property i didn’t know about.
  3. Learn that there’s a command like repack() or something that resizes things at runtime (some languages have this).
  4. Give up on cool textures and just use normal buttons.
  5. Give up on localizing. Everyone in the world prefers English, right?

You can give cool textures to normal buttons using a theme. It’s more work than a TextureButton but it will achieve the same effect. TextureButtons are good for one-off stylistic buttons, not better than normal buttons.

1 Like

Oh hey, look at that. i didn’t realize i could keep the text with that.

Looks like i lose shadow support for the font (seems like that’s only labels, not buttons) but otherwise it looks the same. Cool.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.