Add a getter for asset watching status on AssetServer
(#11578)
# Objective - Closes #11490. - Allow retrieving the current asset watch behavior from the `AssetServer`. ## Solution - Add the corresponding getter. (also fixes some trailing whitespace). A corresponding helper could also be added on the `AssetPlugin` struct (returning `self.watch_for_changes_override.unwrap_or(cfg!(feature = "watch"))`), but it seems it isn't a current practice to have actual methods on the plugin structs appart from the `Plugin` impl. --- ## Changelog ### Added Added `watching_for_changes` getter on `AssetServer`. --------- Co-authored-by: Mateusz Wachowiak <mateusz_wachowiak@outlook.com>
This commit is contained in:
parent
8851532890
commit
dad379cdca
@ -128,6 +128,11 @@ impl AssetServer {
|
||||
self.data.sources.get(source.into())
|
||||
}
|
||||
|
||||
/// Returns true if the [`AssetServer`] watches for changes.
|
||||
pub fn watching_for_changes(&self) -> bool {
|
||||
self.data.infos.read().watching_for_changes
|
||||
}
|
||||
|
||||
/// Registers a new [`AssetLoader`]. [`AssetLoader`]s must be registered before they can be used.
|
||||
pub fn register_loader<L: AssetLoader>(&self, loader: L) {
|
||||
let mut loaders = self.data.loaders.write();
|
||||
|
Loading…
Reference in New Issue
Block a user