diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index 677f1e053e..dfa4bd2d35 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -322,8 +322,7 @@ impl Clone for Handle { /// To convert back to a typed handle, use the [typed](HandleUntyped::typed) method. #[derive(Debug)] pub struct HandleUntyped { - /// An unique identifier to an Asset. - pub id: HandleId, + id: HandleId, handle_type: HandleType, } @@ -352,6 +351,12 @@ impl HandleUntyped { } } + /// The ID of the asset. + #[inline] + pub fn id(&self) -> HandleId { + self.id + } + /// Creates a weak copy of this handle. #[must_use] pub fn clone_weak(&self) -> Self { diff --git a/examples/2d/texture_atlas.rs b/examples/2d/texture_atlas.rs index be41577cc5..14d9119ebe 100644 --- a/examples/2d/texture_atlas.rs +++ b/examples/2d/texture_atlas.rs @@ -34,8 +34,8 @@ fn check_textures( rpg_sprite_handles: ResMut, asset_server: Res, ) { - if let LoadState::Loaded = - asset_server.get_group_load_state(rpg_sprite_handles.handles.iter().map(|handle| handle.id)) + if let LoadState::Loaded = asset_server + .get_group_load_state(rpg_sprite_handles.handles.iter().map(|handle| handle.id())) { state.set(AppState::Finished).unwrap(); }