Skip to content

Commit 9e4c072

Browse files
Fix logic error in loading_screen.rs (#16989)
# Objective Fix #16792 ## Solution Fix the logic to retain loaded ones ## Testing Unable to test due to #16988
1 parent 9cebc66 commit 9e4c072

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

examples/games/loading_screen.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,11 @@ fn update_loading_data(
204204
// we reset the confirmation frame count.
205205
loading_data.confirmation_frames_count = 0;
206206

207-
// Go through each asset and verify their load states.
208-
// Any assets that are loaded are then added to the pop list for later removal.
209-
let mut pop_list: Vec<usize> = Vec::new();
210-
for (index, asset) in loading_data.loading_assets.iter().enumerate() {
211-
if let Some(state) = asset_server.get_load_states(asset) {
212-
if state.2.is_loaded() {
213-
pop_list.push(index);
214-
}
215-
}
216-
}
217-
218-
// Remove all loaded assets from the loading_assets list.
219-
for i in pop_list.iter() {
220-
loading_data.loading_assets.remove(*i);
221-
}
207+
loading_data.loading_assets.retain(|asset| {
208+
asset_server
209+
.get_recursive_dependency_load_state(asset)
210+
.is_none_or(|state| !state.is_loaded())
211+
});
222212

223213
// If there are no more assets being monitored, and pipelines
224214
// are compiled, then start counting confirmation frames.

0 commit comments

Comments
 (0)