-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Panic after spawning NodeComponents in POST_UPDATE stage #682
Comments
I ran into this issue too and dug into it a bit. Here's what I found out. bevy/crates/bevy_ui/src/flex/mod.rs Lines 193 to 201 in 871b47f
bevy/crates/bevy_ui/src/flex/mod.rs Lines 139 to 141 in 871b47f
Changing the first section of code to always call I'm guessing this is related to #68 ? |
Yeah, fixing #68 likely would fix this. I think it's really related to the larger problem of how bevy manages and documents system dependencies. |
My default answer here is that you shouldn't spawn a game entity in POST_UPDATE. Bevy's stages each have different assumptions. UPDATE is where "game logic" goes. POST_UPDATE is where "responses to game logic" go. Spawning a NodeBundle entity is "game logic". Trying to do that in POST_UPDATE means we're skipping the relevant "responses to game logic" for that entity. Similar: #1102 (comment) |
Yeah, I've come to agree with that since I created this issue. The only reason I think it might still be an issue is the lack of a clear error when it happens. But I also don't have a good suggestion for how to get a better error. |
Yeah the problem is that it will fail differently for each context. Handling each specific error case for each stage in code seems like a maintenance / performance nightmare. |
I think this probably needs to be handled with better documentation for each stage. |
Closing as #68 is now resolved. |
If I spawn a NodeComponent bundle from a system running in the POST_UPDATE stage I get a panic on this line: https://github.com/bevyengine/bevy/blob/master/crates/bevy_ui/src/flex/mod.rs#L135
The same system running in UPDATE doesn't trigger a panic. In this example, changing line 6 to
add_system(node_adder.system())
makes the panic disappear.The text was updated successfully, but these errors were encountered: