Skip to content
Discussion options

You must be logged in to vote

I now understand what is going on.

You are dropping the handle, and the Gltf asset gets unloaded before you have time to retrieve it from the Assets.

In this:

fn load_modular_house(asset: Res<AssetServer>) {
    let _: Handle<Gltf> = asset.load("ModularHouse.gltf");
}

You drop the handle immediately after loading the asset. When there is no more handles referencing an asset existing, the asset is unloaded (https://docs.rs/bevy/latest/bevy/asset/struct.Handle.html#strong-and-weak).

I suspect sometimes the asset systems notice before/after your spawn_modular_house system runs, which lead to the inconsistent behavior.

If you want to keep an asset loaded, you should store the handle in a Reso…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@TsujimotoYukasuke
Comment options

Answer selected by TsujimotoYukasuke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants