Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

godot - GUI elements won't keep size and position

I am trying to create a simple UI, but my elements won't keep their position and size. Every time I run the app, I see something different from what I can see in the editor.

Editor:

Planned out UI

App:

What I see, when I run. The sizes and positions are for some reason reset

question from:https://stackoverflow.com/questions/65903039/gui-elements-wont-keep-size-and-position

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is likely because you're transforming controls placed inside Containers. You should never move nodes placed in containers manually, except for animation purposes at run-time.

To place nodes correctly when using containers, look into setting the size flags (fill, expand, or both) and perhaps use more nested containers.

This pull request will make this limitation more clear once it's merged.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...