+1 vote

I want to create the ability to customize the size of the interface by the user like in minecraft. To do this, I decided to use the scaling of the main interface nodes, but ran into the following problem: anchors stretch the main size of the nodes, and only then apply the scaling. Because of this feature, the interface nodes extend beyond the window.

How to properly implement custom interface scaling?

https://imgur.com/a/CTFYyyC
https://imgur.com/a/PQinRbb

Godot version 3.4
in Engine by (32 points)
edited by

2 Answers

0 votes
0 votes

If I understood you correctly, you're trying to scale a UI node but it's scaling from the wrong position.
I don't know if this solves your problem, but I put together a test and it worked for me by changing the Pivot offset to the bottom center of the node, if it's on the left of the screen set it to the left center.

godot ui scaling

by (20 points)

enter image description here
enter image description here

https://imgur.com/a/CTFYyyC
https://imgur.com/a/PQinRbb

Unfortunately, that's not what I need. I attached screenshots to make my question clearer. Stretching with anchors does not take into account the scaling of the node, which makes it go beyond the edge of the window. The node has a scale of 2, the more I enlarge the panel that way, the more it will extend beyond the edge of the window, and I want it to obey the anchor stretch while maintaining its scale.

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.