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

Feature Request: Add RunCriterias for running vs exiting app #5568

Closed
JonahPlusPlus opened this issue Aug 3, 2022 · 2 comments
Closed

Feature Request: Add RunCriterias for running vs exiting app #5568

JonahPlusPlus opened this issue Aug 3, 2022 · 2 comments
Labels
C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled

Comments

@JonahPlusPlus
Copy link
Contributor

What problem does this solve or what need does it fill?

When an application exits, there is a frame after the window closed. This caused a bug in bevy_flycam which had systems that unwrapped the primary window (on that last frame, it fails to get the window and crashes). This is now fixed and it instead prints warnings when it can't find a window. However, these warnings are unnecessary when exiting the application. It would be nice if the systems didn't run when the application is exiting.

What solution would you like?

It would be nice if Bevy could provide RunCriteria for systems that run only while the application is running and also the opposite, for systems that only run when it is exiting.

They could be called run_if_running and run_if_exiting (I know RunCriteria is being reworked to use bool; I don't know if that will allow for combining/modifying them, but if so, run_if_exiting could just be !run_if_running)

I have tried to create such a system by reading AppExit events and storing the state in a resource, but to no avail.

I'm not sure how Bevy runs RunCriteria, but I imagine it could run each one once (or will with stageless ECS?), which means that upstreaming this behavior means that crates won't have duplicate systems.

What alternative(s) have you considered?

I know there is a lot of changes coming with stageless ECS so maybe there is a future solution I don't know about.

@JonahPlusPlus JonahPlusPlus added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Aug 3, 2022
@mockersf
Copy link
Member

mockersf commented Aug 3, 2022

the specific issue with extra frame on window closed should be fixed by #5558

@JonahPlusPlus
Copy link
Contributor Author

Ah, OK, then there is no need for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

2 participants