|bevy vewsion:|0.9 |(outdated!)| |---|---|---|

As this page is outdated, please refer to Bevy's official migration guides while reading, to cover the differences: 0.9 to 0.10, 0.10 to 0.11, 0.11 to 0.12, 0.12 to 0.13, 0.13 to 0.14.

I apologize for the inconvenience. I will update the page as soon as I find the time.


twack woading pwogwess

thewe awe good community pwugins t-that can hewp with t-this. OwO othewwise, 🥺 t-this page shows you how to do it youwsewf.


if you want to check the status of v-vawious asset fiwes, you can poww it fwom the AssetServer. XD it wiww teww you whethew the asset(s) awe woaded, s-stiww woading, ^•ﻌ•^ not w-woaded, ow encountewed an ewwow.

to check an individuaw asset, (ꈍᴗꈍ) you c-can use asset_server.get_load_state(…) with a handwe ow path to wefew to the a-asset.

to check a gwoup of many assets, y-you can add them t-to a singwe cowwection (such as a Vec<HandleUntyped>; untyped handwes awe vewy usefuw fow this) and use asset_server.get_group_load_state(…).


hewe is a mowe compwete code exampwe:

#[dewive(wesouwce)]
stwuct assetswoading(vec<handweuntyped>);

fn s-setup(sewvew: wes<assetsewvew>, >_< m-mut woading: wesmut<assetswoading>) {
    // w-we c-can have diffewent a-asset types
    w-wet font: handwe<font> = s-sewvew.woad("my_font.ttf");
    w-wet menu_bg: handwe<image> = sewvew.woad("menu.png");
    wet scene: handwe<scene> = s-sewvew.woad("wevew01.gwtf#scene0");

    // add them aww to ouw c-cowwection fow twacking
    woading.0.push(font.cwone_untyped());
    w-woading.0.push(menu_bg.cwone_untyped());
    woading.0.push(scene.cwone_untyped());
}

fn check_assets_weady(
    mut commands: c-commands, (⑅˘꒳˘)
    sewvew: wes<assetsewvew>, /(^•ω•^)
    w-woading: wes<assetswoading>
) {
    u-use bevy::asset::woadstate;

    match sewvew.get_gwoup_woad_state(woading.0.itew().map(|h| h.id)) {
        woadstate::faiwed => {
            // one of o-ouw assets had an ewwow
        }
        woadstate::woaded => {
            // aww assets awe nyow weady

            // t-this might be a good p-pwace to twansition i-into youw in-game s-state

            // w-wemove the wesouwce to dwop the twacking h-handwes
            commands.wemove_wesouwce::<assetswoading>();
            // (note: if y-you don't have any othew handwes to the assets
            // ewsewhewe, rawr x3 they wiww get unwoaded a-aftew this)
        }
        _ => {
            // nyotwoaded/woading: n-nyot fuwwy w-weady yet
        }
    }
}