It seems this crate only keeps track of Loaded assets, and waits indefinitely if some of the assets actually Failed loading. (I drew this conclusion based on the following code. Please correct me if I am wrong.) I don't believe the loading logic could recover after get_load_state returns Failed, so it seems that there is no point waiting any longer.
Rather than waiting for the impossible, it would be great if this crate could also collect all the failures (ideally as asset paths) and transition to a "load failure" state, so the game could do graceful error reporting in this case. I believe there is already enough information for this kind of error reporting via the current AssetCollection interface.
I imagine in the new approach, Loaded and Failed both count as done in terms of progress tracking (perhaps also assert against NotLoaded and Unloaded, because it should be impossible to have such values returned from get_load_state in the loading stage), collect all the asset paths for Failed assets, and after done >= total, transition to either the "success" or the "failure" state according to the number of Failed assets. IMO tracking the Failed assets should not introduce too much overhead, so it could be the default behaviour (or of course, it could also be behind a feature gate). An alternative approach would be to unconditionally transition to the only "next" state, and let the systems there check the loading status manually by e.g. querying the existence of the AssetLoadingFailure resource.
It seems this crate only keeps track of
Loaded
assets, and waits indefinitely if some of the assets actuallyFailed
loading. (I drew this conclusion based on the following code. Please correct me if I am wrong.) I don't believe the loading logic could recover afterget_load_state
returnsFailed
, so it seems that there is no point waiting any longer.https://github.com/NiklasEi/bevy_asset_loader/blob/79d604dde42ccb36f7573bbc95bf22feb9836bc3/bevy_asset_loader/src/loading_state/systems.rs#L77-L83
Rather than waiting for the impossible, it would be great if this crate could also collect all the failures (ideally as asset paths) and transition to a "load failure" state, so the game could do graceful error reporting in this case. I believe there is already enough information for this kind of error reporting via the current
AssetCollection
interface.I imagine in the new approach,
Loaded
andFailed
both count asdone
in terms of progress tracking (perhaps also assert againstNotLoaded
andUnloaded
, because it should be impossible to have such values returned fromget_load_state
in the loading stage), collect all the asset paths forFailed
assets, and afterdone >= total
, transition to either the "success" or the "failure" state according to the number ofFailed
assets. IMO tracking theFailed
assets should not introduce too much overhead, so it could be the default behaviour (or of course, it could also be behind a feature gate). An alternative approach would be to unconditionally transition to the only "next" state, and let the systems there check the loading status manually by e.g. querying the existence of theAssetLoadingFailure
resource.