#Sometimes image is not displayed
10 messages · Page 1 of 1 (latest)
worth noting that when image is not displayed, I can see in bevy_editor_pls that Handle<TextureAtlas> is empty
I'm loading all image on one state and displaying player on another, can it be that handle somehow expired between this states?
spritesheet loading and texture creating done in this way
#[derive(Default)]
pub struct TextureAtlases{
pub player: Handle<TextureAtlas>,
}
...
mut texture_handles: ResMut<TextureAtlases>,
...
loading.0.append(&mut asset_server.load_folder("images").unwrap().clone());
texture_handles.player = textures.add(TextureAtlas::from_grid(
asset_server.get_handle("images/players.png"),
Vec2::new(32.,32.),
11,
11
));
than in other state, I'm using texture handle stored in resource
My understanding is that loading of resources is not tied to stages. It's totally asynchronous. It becomes available when it's ready
so the problem is that I should wait for assets are actually continue loading?
It depends. You can wait until your asset is loaded if you wish, by using asset events. Or you can use an asset handle normally even if it refers to an asset that hasn't been loaded yet, and it will sort of pop into existence when it's loaded
it will sort of pop into existence when it's loaded in my case if it not shown-up then it will not never in future. Unless I restart app