-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 node layout doesn't refresh when patching entity children #9492
Comments
This wasn't what I thought it was initially at all, it's a bug in transform propagation. Issue #9517. |
I'm attempting to verify that this fixes my problem. Unfortunately I'm having trouble using the bevy main branch - bevy_trait_query no longer works (compilation error), and my UI code depends on that. |
You could try a system that forces the transforms to update every frame. Something like this should work: fn force_update(mut transforms: Query<&mut Transform>) {
for mut transform in transforms.iter_mut() {
transform.set_changed();
}
} Then, assuming that works, you could make some sort of |
Yep, that did the trick! Looks beautiful. |
…tities query (#9518) # Objective `sync_simple_transforms` only checks for removed parents and doesn't filter for `Without<Parent>`, so it overwrites the `GlobalTransform` of non-orphan entities that were orphaned and then reparented since the last update. Introduced by #7264 ## Solution Filter for `Without<Parent>`. Fixes #9517, #9492 ## Changelog `sync_simple_transforms`: * Added a `Without<Parent>` filter to the orphaned entities query.
This was fixed, can be closed. |
…tities query (bevyengine#9518) # Objective `sync_simple_transforms` only checks for removed parents and doesn't filter for `Without<Parent>`, so it overwrites the `GlobalTransform` of non-orphan entities that were orphaned and then reparented since the last update. Introduced by bevyengine#7264 ## Solution Filter for `Without<Parent>`. Fixes bevyengine#9517, bevyengine#9492 ## Changelog `sync_simple_transforms`: * Added a `Without<Parent>` filter to the orphaned entities query.
Bevy version
0.11.1
What you did
I'm writing a UI system that has a "virtual DOM" similar to what React does. This entails doing a "diff" between the old and new node hierarchy, and then incrementally patching the tree of entities based on what's changed.
What I have discovered is that Bevy UI doesn't like this very much. Specifically, when I have a node that has some number of children, and I replace some of the children but not others, the layout gets messed up. Even more significant, is that if I resize the window even a tiny bit, the layout fixes itself. So something is not getting refreshed.
Specifically, what I am doing is (pseudo-code):
parent.replace_children()
.What went wrong
What I'm seeing is that the node layout is random, nodes appearing displaced from where they should be, nodes off the edge of the screen and so on.
Additional information
The problem only seems to manifest when I enable mixing of new and old children. I can disable the bug in one of two ways: either by re-creating the node tree every time (by disabling the diff algorithm), or by not mutating the tree at all.
I realize that you'll probably want a reproducible case. I can provide this, but it's a considerable amount of work and will take some time. That is, I can easily demonstrate the bug in my current github repo, but if you want a "minimal" example I'll need to spend time cutting out all of the parts of the game that aren't relevant to the bug, which can go on a branch or something.
Let me know what you need.
The text was updated successfully, but these errors were encountered: