Skip to content

feat: improve warning on missing asset #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading