diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs index 58e7bbef814c3..fb01fed3b1804 100644 --- a/crates/bevy_asset/src/asset_server.rs +++ b/crates/bevy_asset/src/asset_server.rs @@ -93,10 +93,19 @@ impl AssetServer { } pub(crate) fn register_asset_type(&self) -> Assets { - self.server.asset_lifecycles.write().insert( - T::TYPE_UUID, - Box::new(AssetLifecycleChannel::::default()), - ); + if self + .server + .asset_lifecycles + .write() + .insert( + T::TYPE_UUID, + Box::new(AssetLifecycleChannel::::default()), + ) + .is_some() + { + panic!("Error while registering new asset type: {:?} with UUID: {:?}. Another type with the same UUID is already registered. Can not register new asset type with the same UUID", + std::any::type_name::(), T::TYPE_UUID); + } Assets::new(self.server.asset_ref_counter.channel.sender.clone()) }