-
-
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
Application should be returned when Bevy runner terminate #2937
Comments
You can do this using bevy/crates/bevy_winit/src/lib.rs Lines 176 to 184 in 997eae6
|
If you don't run your loop with Winit, can you do that ? Especially when bevy_winit is an optionnal dependency (windowing is not needed for all case, headless you don't care about that and disable the dependency). |
Sorry, got confused with what you wanted. The runner consumes the |
I end up doing this :
No need to change signature, no need to add a new trait for App. Work perfectly, but it's a bit weird to have to do all this dance. Anyway, thanks for the information. |
What problem does this solve or what need does it fill?
Bevy can be run in headless mode, where you often want to introspect the state of the world (ressource, query, ...) and assert something for test and debugging. Some usefull data are present in Bevy, like time since startup, the whole world state, ...
When an application is constructed and App::run() is called, the application never terminate unless :
When the application terminate, App::run() return nothing and you have no way to introspect the final state because the application is now empty due to std::mem::replace.
What solution would you like?
Since there's a clear owner of the Application (the runner), the runner should be able to return the Application and borrow checker should not complain about that.
We can either :
What alternative(s) have you considered?
Don't return the Application and let the user with an empty application. If user don't have any background with std::mem::replace, confusion can happen. The user expect the application to be in final state, they don't expect an empty application.
Additional context
/
The text was updated successfully, but these errors were encountered: