diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index 1c1a5a72dcc2e..980b68b7361a1 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -222,7 +222,7 @@ use bevy_ecs::{ schedule::{IntoScheduleConfigs, SystemSet}, world::FromWorld, }; -use bevy_platform::collections::HashSet; +use bevy_platform::collections::{HashMap, HashSet}; use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath}; use core::any::TypeId; use tracing::error; @@ -548,6 +548,22 @@ impl VisitAssetDependencies for HashSet { } } +impl VisitAssetDependencies for HashMap> { + fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId)) { + for dependency in self.values() { + visit(dependency.id().untyped()); + } + } +} + +impl VisitAssetDependencies for HashMap { + fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId)) { + for dependency in self.values() { + visit(dependency.id()); + } + } +} + /// Adds asset-related builder methods to [`App`]. pub trait AssetApp { /// Registers the given `loader` in the [`App`]'s [`AssetServer`]. @@ -2030,6 +2046,10 @@ mod tests { set_handles: HashSet>, #[dependency] untyped_set_handles: HashSet, + #[dependency] + map_handles: HashMap<(), Handle>, + #[dependency] + untyped_map_handles: HashMap<(), UntypedHandle>, }, StructStyle(#[dependency] TestAsset), Empty, @@ -2053,6 +2073,10 @@ mod tests { set_handles: HashSet>, #[dependency] untyped_set_handles: HashSet, + #[dependency] + map_handles: HashMap<(), Handle>, + #[dependency] + untyped_map_handles: HashMap<(), UntypedHandle>, } #[expect(