Trait bevy_asset::DirectAssetAccessExt
source · pub trait DirectAssetAccessExt {
// Required methods
fn add_asset<A: Asset>(&mut self, asset: impl Into<A>) -> Handle<A>;
fn load_asset<'a, A: Asset>(
&self,
path: impl Into<AssetPath<'a>>
) -> Handle<A>;
fn load_asset_with_settings<'a, A: Asset, S: Settings>(
&self,
path: impl Into<AssetPath<'a>>,
settings: impl Fn(&mut S) + Send + Sync + 'static
) -> Handle<A>;
}
Required Methods§
sourcefn add_asset<A: Asset>(&mut self, asset: impl Into<A>) -> Handle<A>
fn add_asset<A: Asset>(&mut self, asset: impl Into<A>) -> Handle<A>
Insert an asset similarly to Assets::add
.
sourcefn load_asset<'a, A: Asset>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>
fn load_asset<'a, A: Asset>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>
Load an asset similarly to AssetServer::load
.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl DirectAssetAccessExt for World
impl DirectAssetAccessExt for World
source§fn add_asset<'a, A: Asset>(&mut self, asset: impl Into<A>) -> Handle<A>
fn add_asset<'a, A: Asset>(&mut self, asset: impl Into<A>) -> Handle<A>
Insert an asset similarly to Assets::add
.
§Panics
If self
doesn’t have an AssetServer
resource initialized yet.
source§fn load_asset<'a, A: Asset>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>
fn load_asset<'a, A: Asset>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>
Load an asset similarly to AssetServer::load
.
§Panics
If self
doesn’t have an AssetServer
resource initialized yet.
source§fn load_asset_with_settings<'a, A: Asset, S: Settings>(
&self,
path: impl Into<AssetPath<'a>>,
settings: impl Fn(&mut S) + Send + Sync + 'static
) -> Handle<A>
fn load_asset_with_settings<'a, A: Asset, S: Settings>( &self, path: impl Into<AssetPath<'a>>, settings: impl Fn(&mut S) + Send + Sync + 'static ) -> Handle<A>
Load an asset with settings, similarly to AssetServer::load_with_settings
.
§Panics
If self
doesn’t have an AssetServer
resource initialized yet.