pub fn with_collection<A: AssetCollection>(mut self) -> Self {
        self.load = self.load.with_system(start_loading::<A>.system());
        self.check = self.check.with_system(check_loading_state::<T, A>.system());
        self.collection_count += 1;

        self
    }
/// Add an [AssetCollection] to the [AssetLoader]
///
/// The added collection will be loaded and inserted into your Bevy App as a resource.
/// ```edition2018
/// # use bevy_asset_loader::{AssetLoader, AssetCollection};
/// # use bevy::prelude::*;
/// # use bevy::asset::AssetPlugin;
/// # fn main() {
///     let mut app = App::build();
///     AssetLoader::new(GameState::Loading, GameState::Menu)
///         .with_collection::<AudioAssets>()
///         .with_collection::<TextureAssets>()
///         .build(&mut app);
/// #   app
/// #       .add_state(GameState::Loading)
/// #       .add_plugins(MinimalPlugins)
/// #       .add_plugin(AssetPlugin::default())
/// #       .set_runner(|mut app| app.schedule.run(&mut app.world))
/// #       .run();
/// # }
/// # #[derive(Clone, Eq, PartialEq, Debug, Hash)]
/// # enum GameState {
/// #     Loading,
/// #     Menu
/// # }
/// # #[derive(AssetCollection)]
/// # pub struct AudioAssets {
/// #     #[asset(path = "audio/flying.ogg")]
/// #     pub flying: Handle<AudioSource>,
/// # }
/// # #[derive(AssetCollection)]
/// # pub struct TextureAssets {
/// #     #[asset(path = "textures/player.png")]
/// #     pub player: Handle<Texture>,
/// #     #[asset(path = "textures/tree.png")]
/// #     pub tree: Handle<Texture>,
/// # }
/// ```
Add an [AssetCollection] to the [AssetLoader]
The added collection will be loaded and inserted into your Bevy App as a resource.
Add an [ AssetCollection ] to the [ AssetLoader ] The added collection will be loaded and inserted into your Bevy App as a resource .
pub fn with_collection<A: AssetCollection>(mut self) -> Self {
        self.load = self.load.with_system(start_loading::<A>.system());
        self.check = self.check.with_system(check_loading_state::<T, A>.system());
        self.collection_count += 1;
        self
    }
pub fn with_collection < A : AssetCollection > ( mut self ) -> Self { self . load = self . load . with_system ( start_loading :: < A > . system ( ) ) ; self . check = self . check . with_system ( check_loading_state :: < T , A > . system ( ) ) ; self . collection_count += 1 ; self }
Add an [AssetCollection] to the [AssetLoader]
The added collection will be loaded and inserted into your Bevy App as a resource.
Add an [ AssetCollection ] to the [ AssetLoader ] The added collection will be loaded and inserted into your Bevy App as a resource .
mut self
mut self
use bevy_asset_loader::{assetloader, assetcollection};
None
use bevy::prelude::*;
None
use bevy::asset::assetplugin;
None
fn main() {
let mut app = App::build();
AssetLoader::new(GameState::Loading, GameState::Menu)
.with_collection::()
.with_collection::()
.build(&mut app).
let mut app = App :: build () ; AssetLoader :: new ( GameState :: Loading GameState :: Menu ) . with_collection :: () . with_collection :: () . build ( &mut app ) .
app
None
.add_state(gamestate::loading)
None
.add_plugins(minimalplugins)
None
.add_plugin(assetplugin::default())
None
.set_runner(|mut app| app.schedule.run(&mut app.world))
None
.run();
None
}
None
#[derive(clone, eq, partialeq, debug, hash)]
None
enum gamestate {
None
loading,
None
menu
None
}
None
#[derive(assetcollection)]
None
pub struct audioassets {
None
#[asset(path = "audio/flying.ogg")]
None
pub flying: handle<audiosource>,
None
}
None
#[derive(assetcollection)]
None
pub struct textureassets {
None
#[asset(path = "textures/player.png")]
None
pub player: handle<texture>,
None
#[asset(path = "textures/tree.png")]
None
pub tree: handle<texture>,
None
}
None