I have this situation:
impl Plugin for PausePlugin {
fn build(&self, app: &mut App) {
app.add_systems(PreUpdate, debug_pre);
app.add_systems(Last, debug);
}
}
fn debug(mut events: EventReader<WindowOccluded>) {
for event in events.read() {
if event.occluded {
error!("LAST PAUSE");
} else {
error!("LAST PAUSE");
}
}
}
fn debug_pre(mut events: EventReader<WindowOccluded>) {
for event in events.read() {
if event.occluded {
error!("PREUPDATE PAUSE");
} else {
error!("PREUPDATE UNPAUSE");
}
}
}
What I want is:
- to run
app.update()once after I switched to a new tab
What I observe:
- it seems like
app.update()doesn't run when I switch to a new tab. When I come back to the tab. I see all 4 logs at once:- PREUPDATE PAUSE
- PREUPDATE UNPAUSE
- LAST PAUSE
- LAST UNPAUSE
Would there be a way to make this happen?