diff --git a/crates/bevy_asset/src/assets.rs b/crates/bevy_asset/src/assets.rs index 5d0a5796a9..526ba4dc88 100644 --- a/crates/bevy_asset/src/assets.rs +++ b/crates/bevy_asset/src/assets.rs @@ -423,6 +423,7 @@ impl Assets { } #[inline] + /// Retrieves many references to the [`Asset`] with the given `id`s, if they exists. pub fn get_many(&self, ids: [AssetId; N]) -> [Option<&A>; N] { ids.map(|id| self.get(id)) } @@ -444,13 +445,15 @@ impl Assets { #[inline] #[allow(unsafe_code)] + /// Retrieves may mutable references to the [`Asset`]s with the given `id`s, if they exists. + /// Will return `None` if any `id`s alias. pub fn get_many_mut( &mut self, ids: [AssetId; N], ) -> Option<[Option<&mut A>; N]> { use std::mem::MaybeUninit; - // SAFETY: Verify that all entities are unique + // SAFETY: Verify that all indices are unique for i in 0..N { for j in 0..i { if ids[i] == ids[j] {