Bevy version and features
bevy = { version = "0.19.0" }
[Optional] Relevant system information
cargo 1.95.0 (f2d3ce0bd 2026-03-21)
Zen 1.21.5b (Firefox 152.0.4) (64-bit)
RX 7900 XT GPU
App compiled for Wasm with wasm-pack build --release --target web, wasm-pack 0.15.0
What you did
first discussed here: https://discord.com/channels/691052431525675048/1525161866735779840
During migration from 0.18.1 to 0.19.0, my loading states inspired by the Loading screen example were no longer updating. This part of the code worked fine since I first wrote it in 0.16.x. Tracked this down to this function never actually saying pipelines were ready, even tho the scene was rendering fine already:
update_pipelines_ready start threed.js:1309:21
Some pipelines: 1
^ gets repeated in the console indefnitely
fn update_pipelines_ready(mut main_world: ResMut<MainWorld>, pipelines: Res<PipelineCache>) {
console_log("update_pipelines_ready start");
if let Some(mut pipelines_ready) = main_world.get_resource_mut::<PipelinesReady>() {
console_log(&format!(
"Some pipelines: {}",
pipelines.waiting_pipelines().count()
));
pipelines_ready.0 = pipelines.waiting_pipelines().count() == 0;
}
}
What went wrong
LoadingState never switched to Ready, cause pipelines were never done.
Additional information
Entire loading snippet:
pub struct LoadingStateTracker;
impl Plugin for LoadingStateTracker {
fn build(&self, app: &mut App) {
app.insert_resource(PipelinesReady::default())
.insert_resource(LoadingData::new(5))
.insert_resource(LoadingState::default())
.add_systems(Update, update_loading_data);
app.sub_app_mut(bevy::render::RenderApp)
.add_systems(ExtractSchedule, update_pipelines_ready);
}
}
#[derive(Resource, Debug, Default)]
struct PipelinesReady(pub bool);
#[derive(Resource, Default, Debug, PartialEq)]
pub enum LoadingState {
Ready,
#[default]
Loading,
}
#[derive(Resource, Debug, Default)]
struct LoadingData {
loading_assets: Vec<UntypedHandle>,
confirmation_frames_target: usize,
confirmation_frames_count: usize,
}
impl LoadingData {
fn new(confirmation_frames_target: usize) -> Self {
Self {
loading_assets: Vec::new(),
confirmation_frames_target,
confirmation_frames_count: 0,
}
}
}
fn update_pipelines_ready(mut main_world: ResMut<MainWorld>, pipelines: Res<PipelineCache>) {
if let Some(mut pipelines_ready) = main_world.get_resource_mut::<PipelinesReady>() {
pipelines_ready.0 = pipelines.waiting_pipelines().count() == 0;
}
}
fn update_loading_data(
mut loading_data: ResMut<LoadingData>,
mut loading_state: ResMut<LoadingState>,
asset_server: Res<AssetServer>,
pipelines_ready: Res<PipelinesReady>,
) {
console_log(&format!(
" if !{} || !{}",
loading_data.loading_assets.is_empty(),
pipelines_ready.0
));
if !loading_data.loading_assets.is_empty() || !pipelines_ready.0 {
console_log("still loading...");
loading_data.confirmation_frames_count = 0;
loading_data.loading_assets.retain(|asset| {
asset_server
.get_recursive_dependency_load_state(asset)
.is_none_or(|state| !state.is_loaded())
});
} else {
loading_data.confirmation_frames_count += 1;
if loading_data.confirmation_frames_count == loading_data.confirmation_frames_target {
*loading_state = LoadingState::Ready;
}
}
}
Bevy version and features
bevy = { version = "0.19.0" }
[Optional] Relevant system information
cargo 1.95.0 (f2d3ce0bd 2026-03-21)
Zen 1.21.5b (Firefox 152.0.4) (64-bit)
RX 7900 XT GPU
App compiled for Wasm with
wasm-pack build --release --target web, wasm-pack 0.15.0What you did
first discussed here: https://discord.com/channels/691052431525675048/1525161866735779840
During migration from 0.18.1 to 0.19.0, my loading states inspired by the Loading screen example were no longer updating. This part of the code worked fine since I first wrote it in 0.16.x. Tracked this down to this function never actually saying pipelines were ready, even tho the scene was rendering fine already:
update_pipelines_ready start threed.js:1309:21Some pipelines: 1^ gets repeated in the console indefnitely
What went wrong
LoadingState never switched to Ready, cause pipelines were never done.
Additional information
Entire loading snippet: