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

Run conditions for specific state transitions #7647

Closed
ItsDoot opened this issue Feb 12, 2023 · 1 comment · Fixed by #7936
Closed

Run conditions for specific state transitions #7647

ItsDoot opened this issue Feb 12, 2023 · 1 comment · Fixed by #7936
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use
Milestone

Comments

@ItsDoot
Copy link
Contributor

ItsDoot commented Feb 12, 2023

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

I want to be able to run some cleanup logic only during a specific state transition.

What solution would you like?

Access to either previous_state + current_state, or current_state + next_state during an on_exit system.

What alternative(s) have you considered?

Currently my cleanup logic is held in the system that starts the state transition.

Additional Notes

The short discussion in discord, prior to filing this issue: https://discord.com/channels/691052431525675048/742569353878437978/1074101538802389012

@ItsDoot ItsDoot added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Feb 12, 2023
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled C-Feature A new feature, making something new possible labels Feb 13, 2023
@alice-i-cecile alice-i-cecile added this to the 0.11 milestone Feb 13, 2023
@LiamGallagher737
Copy link
Member

Also looking for something like this.

I like the idea of something like

.add_system_to_schedule(OnChange(GameState::A, GameState::B), my_system)

Though it's not very clear if this goes one or both ways. Something like OnTransition may work better.

@ItsDoot ItsDoot changed the title Add or document an idiomatic way to check for a specific state transition during an on_exit system. Run conditions for specific state transitions Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants