pub fn new(load: T, next: T) -> AssetLoader<T> {
        Self {
            next,
            load: SystemSet::on_enter(load.clone()),
            check: SystemSet::on_update(load),
            collection_count: 0,
        }
    }
/// Create a new [AssetLoader]
///
/// This function takes two States. During the first all assets will be loaded and the
/// collections will be inserted as resources. Then the second state is set in your Bevy App.
/// ```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>,
/// # }
/// ```
Create a new [AssetLoader]
This function takes two States. During the first all assets will be loaded and the
collections will be inserted as resources. Then the second state is set in your Bevy App.
Create a new [ AssetLoader ] This function takes two States . During the first all assets will be loaded and the collections will be inserted as resources . Then the second state is set in your Bevy App .
pub fn new(load: T, next: T) -> AssetLoader<T> {
        Self {
            next,
            load: SystemSet::on_enter(load.clone()),
            check: SystemSet::on_update(load),
            collection_count: 0,
        }
    }
pub fn new ( load : T , next : T ) -> AssetLoader < T > { Self { next , load : SystemSet :: on_enter ( load . clone ( ) ) , check : SystemSet :: on_update ( load ) , collection_count : 0 , } }
Create a new [AssetLoader]
This function takes two States.
Create a new [ AssetLoader ] This function takes two States .
load
T
next
T
load
T
next
T
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