TextureButton sprite position move unexpectedly when pressed

Godot Version

Godot Version 4.4.1 stable

Question

Hi,

I’m new to Godot, I got a problem regarding to button sprite change, please help.

I got a button, it has two textures represent its normal form(raised) and pressed form(sunken). When I’m pressing the button, the texture changes(as the images shown below).

What I expected:
when the button is pressed, the bottom/base is supposed to stay fixed while the top of the button supposed to move down (though it’s not actually moving, it’s just changing a texture with a shorter size-y).

What I got:
However when I tested it, it behaved in the opposite way, which the top of the button is stay fixed, and the bottom/base is moving up.

I tried to play around with the pivot, tried moving the pivot to the bottom of the button, but it doesn’t fix the issue.

Please help, Thank you in advance :smiley:

You need to change your sprites so that they align as you want. It looks like your ‘pressed’ sprite has some empty pixels under the button but your ‘unpressed’ sprite don’t have it.
Or if it’s an AtlasTexture, then you need to make sure you selected the region with the same logic.

1 Like

Thanks a lot, that fixed my issue perfectly :saluting_face:

1 Like

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