diff --git a/crates/bevy_asset/src/loader.rs b/crates/bevy_asset/src/loader.rs index 2b76edadf8434..55611b6a1803a 100644 --- a/crates/bevy_asset/src/loader.rs +++ b/crates/bevy_asset/src/loader.rs @@ -1,6 +1,6 @@ use crate::{ path::AssetPath, AssetIo, AssetIoError, AssetMeta, AssetServer, Assets, Handle, HandleId, - RefChangeChannel, + HandleUntyped, RefChangeChannel, }; use anyhow::Error; use anyhow::Result; @@ -166,11 +166,16 @@ impl<'a> LoadContext<'a> { self.get_handle(AssetPath::new_ref(self.path(), Some(label))) } - /// Gets a handle to an asset of type `T` from its id. + /// Gets a strong handle to an asset of type `T` from its id. pub fn get_handle, T: Asset>(&self, id: I) -> Handle { Handle::strong(id.into(), self.ref_change_channel.sender.clone()) } + /// Gets an untyped strong handle for an asset with the provided id. + pub fn get_handle_untyped>(&self, id: I) -> HandleUntyped { + HandleUntyped::strong(id.into(), self.ref_change_channel.sender.clone()) + } + /// Reads the contents of the file at the specified path through the [`AssetIo`] associated /// with this context. pub async fn read_asset_bytes>(&self, path: P) -> Result, AssetIoError> {