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
This commit is contained in:
Daniel McNab 2022-01-21 00:29:29 +00:00
parent f1f6fd349a
commit f3de12bc5e
3 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,7 @@ impl AssetIo for AndroidAssetIo {
} }
fn watch_for_changes(&self) -> Result<(), AssetIoError> { fn watch_for_changes(&self) -> Result<(), AssetIoError> {
bevy_log::warn!("Watching for changes is not supported on Android");
Ok(()) Ok(())
} }

View File

@ -104,6 +104,8 @@ impl AssetIo for FileAssetIo {
{ {
*self.filesystem_watcher.write() = Some(FilesystemWatcher::default()); *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(()) Ok(())
} }

View File

@ -46,6 +46,7 @@ impl AssetIo for WasmAssetIo {
} }
fn watch_for_changes(&self) -> Result<(), AssetIoError> { fn watch_for_changes(&self) -> Result<(), AssetIoError> {
bevy_log::warn!("Watching for changes is not supported in WASM");
Ok(()) Ok(())
} }