use bevy::{prelude::*, text::FontAtlasSet}; fn main() { App::build() .init_resource::() .add_default_plugins() .add_startup_system(setup.system()) .add_system(text_update_system.system()) .add_system(atlas_render_system.system()) .run(); } struct State { added: bool, handle: Handle, timer: Timer, } impl Default for State { fn default() -> Self { Self { added: false, handle: Handle::default(), timer: Timer::from_seconds(0.05), } } } fn atlas_render_system( mut commands: Commands, mut state: ResMut, mut materials: ResMut>, font_atlas_sets: Res>, texture_atlases: Res>, ) { if state.added { return; } if let Some(set) = font_atlas_sets.get(&state.handle.as_handle::()) { for (_size, font_atlas) in set.iter() { state.added = true; let texture_atlas = texture_atlases.get(&font_atlas.texture_atlas).unwrap(); commands.spawn(SpriteComponents { material: materials.add(texture_atlas.texture.into()), translation: Vec3::new(-300.0, 0., 0.0).into(), ..Default::default() }); break; } } } fn text_update_system(mut state: ResMut, time: Res