Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...