Cleanup: Use the teardown/exit schedule (once it exists) to mass unsubscribe active subscriptions
- 主要言語
- Rust
- スター
- 25
- フォーク
- 2
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Upstream issue: https://github.com/bevyengine/bevy/issues/7067
The teardown logic of observable pipelines must be reliable, they must be ran exactly once during their lifetime.
Which during the runtime of the app is trivial with an on_remove hook. But entities aren't despawned when the app exits, the app just closes.
Currenly rx_bevy does the next best thing and unsubscribes everything in an exclusive system ran after the AppExit event is written.
```rs
app.add_systems(
Last,
unsubscribe_all_subscriptions
.after(exit_on_all_closed) // from `bevy_window::system`
.run_if(on_event::),
);
```
> Note that while this is an okay-ish solution as long as the app is closed with this event, I've yet to see how this affects sub-apps.
コントリビューションガイド
評価
この issue はまだ評価されていません。