Help creating Icon/text Button

Godot Version

4.3

Question

I am looking to make a custom ui element that is essentially a colored square with text and an image/icon to use in my grid layout.

This is what i have so far:

I am guessing that the sprite doesnt play well with the vbox container. Ideally i would like the icon to take up the top 2/3 of the square and keep is aspect ratio 1:1 and the text would be on the last 1/3.

Brand new to godot so any help would be great.

Using a TextureRect instead of a Sprite2D should do the trick.

Sprite2D is not a Control and therefore not displayed in your User Interface, it’s for displaying sprites in your 2D game world.

Thats does the trick, thanks for the quick reply.

image

1 Like

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