bevy_codex/loading/
mod.rs

1use bevy::prelude::*;
2use bevy_lunex::UiSystems;
3use components::Loading;
4use systems::build_loading;
5
6use crate::UiState;
7
8pub mod components;
9mod styles;
10mod systems;
11
12pub struct LoadingPlugin;
13
14impl Plugin for LoadingPlugin {
15    fn build(&self, app: &mut App) {
16        app.add_systems(Update, build_loading.before(UiSystems::Compute));
17        app.add_systems(
18            OnExit(UiState::Loading),
19            |mut commands: Commands, load_q: Query<Entity, With<Loading>>| {
20                if let Ok(load) = load_q.get_single() {
21                    commands.entity(load).despawn_recursive();
22                }
23            },
24        );
25    }
26}