Skip to content

Commit

Permalink
feat: improve warning on missing asset (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll authored Feb 21, 2025
1 parent 630cac1 commit cced399
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/bevy_mod_scripting_core/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bevy::{
app::{App, PreUpdate},
asset::{Asset, AssetEvent, AssetId, AssetLoader, AssetPath, Assets},
ecs::system::Resource,
log::{debug, error, info, trace},
log::{debug, info, trace, warn},
prelude::{
Commands, Event, EventReader, EventWriter, IntoSystemConfigs, IntoSystemSetConfigs, Res,
ResMut,
Expand Down Expand Up @@ -231,7 +231,7 @@ pub(crate) fn dispatch_script_asset_events(
script_asset_events.send(ScriptAssetEvent::Added(metadata.clone()));
metadata_store.insert(*id, metadata);
} else {
error!("A script was added but it's asset was not found, failed to compute metadata. This script will not be loaded. {}", id);
warn!("A script was added but it's asset was not found, failed to compute metadata. This script will not be loaded. Did you forget to store `Handle<ScriptAsset>` somewhere?. {}", id);
}
}
}
Expand All @@ -240,15 +240,15 @@ pub(crate) fn dispatch_script_asset_events(
debug!("Script removed: {:?}", metadata);
script_asset_events.send(ScriptAssetEvent::Removed(metadata.clone()));
} else {
error!("Script metadata not found for removed script asset: {}. Cannot properly clean up script", id);
warn!("Script metadata not found for removed script asset: {}. Cannot properly clean up script", id);
}
}
AssetEvent::Modified { id } => {
if let Some(metadata) = metadata_store.get(*id) {
debug!("Script modified: {:?}", metadata);
script_asset_events.send(ScriptAssetEvent::Modified(metadata.clone()));
} else {
error!("Script metadata not found for modified script asset: {}. Cannot properly update script", id);
warn!("Script metadata not found for modified script asset: {}. Cannot properly update script", id);
}
}
_ => {}
Expand Down

0 comments on commit cced399

Please sign in to comment.