bevy/examples/asset
Robert Swain e928acb9ff bevy_asset: Add AssetServerSettings watch_for_changes member (#3643)
# Objective

- `asset_server.watch_for_changes().unwrap()` only watches changes for assets loaded **_after_** that call.
- Technically, the `hot_asset_reloading` example is racey as the watch on the asset path is set up in an async task scheduled from the asset `load()`, but the filesystem watcher is only constructed in a call that comes **_after_** the call to `load()`.

## Solution

-  It feels safest to allow enabling watching the filesystem for changes on the asset server from the point of its construction. Therefore, adding such an option to `AssetServerSettings` seemed to be the correct solution.
- Fix `hot_asset_reloading` by inserting the `AssetServerSettings` resource with `watch_for_changes: true` instead of calling `asset_server.watch_for_changes().unwrap()`.
- Document the shortcomings of `.watch_for_changes()`
2022-02-04 03:21:29 +00:00
..
asset_loading.rs Down with the system! (#2496) 2021-07-27 23:42:36 +00:00
custom_asset.rs Down with the system! (#2496) 2021-07-27 23:42:36 +00:00
custom_asset_io.rs Bevy app docs (#3539) 2022-01-06 23:16:47 +00:00
hot_asset_reloading.rs bevy_asset: Add AssetServerSettings watch_for_changes member (#3643) 2022-02-04 03:21:29 +00:00