Centering Button Icon

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chain
:warning: Old Version Published before Godot 3 was released.

Greetings!

I think the headline sums it up quite nicely.

I appreciate every answer :slight_smile:

Have you tried using a CenterContainer node? Try making the icon a child of the CenterContainer node, and see what happens. You can also try using a BoxContainer node, and using the set_alignment() method to center it.

Ertain | 2017-12-15 21:06

Thanks for the reply. I have a Button and set an Icon for it (through Button Control Panel). CenterContainer and BoxContainer won’t have any affect, since the icon is inside the button / part of the button itself.

Chain | 2017-12-15 22:25

:bust_in_silhouette: Reply From: Skyfrit

I don’t think you can center button icon. If there is no text in the button, use TextureButton or TouchScreenButton instead.

I have text in there too :confused:

Chain | 2017-12-16 18:33

I still think TextureButton or TouchScreenButton are your best options. You can use image editing software to put Icon and Text together, then export it as a single image.

Skyfrit | 2017-12-17 09:47