From f3de12bc5e03c58a9b863943b8db84a321422bec Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Fri, 21 Jan 2022 00:29:29 +0000 Subject: [PATCH] Add a warning when `watch_for_changes` has no effect (#3684) # Objective - Users can get confused when they ask for watching to be unsupported, then find it isn't supported - Fixes https://github.com/bevyengine/bevy/issues/3683 ## Solution - Add a warning if the `watch_for_changes` call would do nothing --- crates/bevy_asset/src/io/android_asset_io.rs | 1 + crates/bevy_asset/src/io/file_asset_io.rs | 2 ++ crates/bevy_asset/src/io/wasm_asset_io.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/crates/bevy_asset/src/io/android_asset_io.rs b/crates/bevy_asset/src/io/android_asset_io.rs index 91aa3770e1..4397dcae63 100644 --- a/crates/bevy_asset/src/io/android_asset_io.rs +++ b/crates/bevy_asset/src/io/android_asset_io.rs @@ -42,6 +42,7 @@ impl AssetIo for AndroidAssetIo { } fn watch_for_changes(&self) -> Result<(), AssetIoError> { + bevy_log::warn!("Watching for changes is not supported on Android"); Ok(()) } diff --git a/crates/bevy_asset/src/io/file_asset_io.rs b/crates/bevy_asset/src/io/file_asset_io.rs index a7124c5982..1bd7f1515c 100644 --- a/crates/bevy_asset/src/io/file_asset_io.rs +++ b/crates/bevy_asset/src/io/file_asset_io.rs @@ -104,6 +104,8 @@ impl AssetIo for FileAssetIo { { *self.filesystem_watcher.write() = Some(FilesystemWatcher::default()); } + #[cfg(not(feature = "filesystem_watcher"))] + bevy_log::warn!("Watching for changes is not supported when the `filesystem_watcher` feature is disabled"); Ok(()) } diff --git a/crates/bevy_asset/src/io/wasm_asset_io.rs b/crates/bevy_asset/src/io/wasm_asset_io.rs index 3e66981edc..a4e260d6fe 100644 --- a/crates/bevy_asset/src/io/wasm_asset_io.rs +++ b/crates/bevy_asset/src/io/wasm_asset_io.rs @@ -46,6 +46,7 @@ impl AssetIo for WasmAssetIo { } fn watch_for_changes(&self) -> Result<(), AssetIoError> { + bevy_log::warn!("Watching for changes is not supported in WASM"); Ok(()) }