Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Layout Or Size Can Seem To Shift Unnecessarily Post-Creation #15826

Open
TrialDragon opened this issue Oct 10, 2024 · 7 comments
Open

UI Layout Or Size Can Seem To Shift Unnecessarily Post-Creation #15826

TrialDragon opened this issue Oct 10, 2024 · 7 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@TrialDragon
Copy link
Member

Bevy version

Bevy v0.14.2

What you did

We created a main menu for our game using straight Bevy UI.

What went wrong

On spawning the main menu UI, it shifts / changes during the frame after creation. The expectation is that it would spawn with the correct layout and size, not having to shift to accommodate or conform to what is wanted, since nothing should've changed from the values passed for initial creation.

Video showcasing what I'm talking about specifically:
https://github.com/user-attachments/assets/4c440f45-f723-4c69-ab23-92378c421262

Additional information

My best guess as to what this is, is some form of layout calculations being performed in Bevy UI?

We don't think it's any of our code that is causing this; it still occurs after disabling / removing any systems which may modify UI values post-creation. Tho, if this does end up being a fault in the code we wrote, rather than Bevy UI, or even just intended behavior, then sorry for making this issue and wasting time.

@TrialDragon TrialDragon added A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Oct 10, 2024
@alice-i-cecile
Copy link
Member

Does this happen across all platforms? Can you reproduce this on main? I suspect this is actually windowing related, where we're not getting the right window size soon enough.

@TrialDragon
Copy link
Member Author

TrialDragon commented Oct 10, 2024

I know it occurs on macOS (every time it is spawned), and Linux [Fedora] (I've only seen it the first time it's spawned per run so far). I'll try to make an MRE, and then see if that works on main (I don't want to deal with migrating a whole game to main, especially when I probably should make sure this is reproducible first).

@extrawurst
Copy link
Contributor

I slowed a recording of this down WAY more and cut it to the moment it switches from ingame to menu to illustrate the strange 2 frames that make up this weirdness:

Screenflick.Movie.81.mp4

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Oct 10, 2024

Is there a chance that this is scale factor related? It looks like this is on a mobile phone emulator? Is it consistent every run?

@extrawurst
Copy link
Contributor

extrawurst commented Oct 10, 2024

Nope it’s happening on my macOS build consistently in every run. Of course that also has a scaling factor but I seem to be able to corner it more down to when it got introduced.

and it seems to be an instability related to cramping multiple elements in a column that define height: 100%

@extrawurst
Copy link
Contributor

Speaking of which: https://github.com/DioxusLabs/taffy/releases/tag/v0.6.0 :)

@alice-i-cecile
Copy link
Member

And as a result, #15844 :D I'd love if you could test with that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

3 participants