0 votes

What is the best way to position a button (TextureButton) in the right bottom corner with a 100px margin in both directions?

in Engine by (12 points)

1 Answer

0 votes

In 2D mode, there's a "Layout" Button on the top. Click on it And select "Bottom right".
Then switch to another node and back to that button so the controls values update in the inspector (a little bug).
The layout button updates the values in "Anchor" and sets them to x=1,y=1. That means that this controls relative to the lower right of its parent container/viewport.

Go to "Rect -> Position" and substract 100 from the position values.

You could also change the values in "Margin" (after setting the Anchor) but then you'd have to set both values accordingly.

When the Screen/Parent is resized then the button will be repositioned to always be 100,100 away from the bottom right.

For more info, read here:

by (3,258 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.