Skip to content

Commit 00c8d83

Browse files
committed
Don't force consumers to do hot reloading
1 parent 83be515 commit 00c8d83

File tree

3 files changed

+9
-128
lines changed

3 files changed

+9
-128
lines changed

Cargo.lock

Lines changed: 1 addition & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bevy_plugin/Cargo.toml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ sha2 = "0.10"
2525
rand = { version = "0.8", features = ["small_rng"] }
2626

2727

28-
[target.'cfg(any(target_arch = "wasm32", target_os = "android"))'.dependencies.bevy]
28+
[dependencies.bevy]
2929
version = "0.13"
3030
default-features = false
31-
features = ["bevy_asset", "serialize"]
31+
features = ["bevy_asset", "multi-threaded"]
3232

3333
[dev-dependencies]
3434
tempfile = "3"
@@ -38,18 +38,8 @@ version = "0.13.0"
3838
default-features = false
3939
features = [
4040
"bevy_core_pipeline",
41-
"bevy_render",
42-
"bevy_winit",
43-
"file_watcher",
44-
"x11",
4541
"bevy_audio",
46-
"multi-threaded",
4742
]
4843

49-
[target.'cfg(all(not(target_arch = "wasm32"), not(target_os = "android")))'.dependencies.bevy]
50-
version = "0.13"
51-
default-features = false
52-
features = ["bevy_asset", "serialize", "file_watcher",]
53-
5444
[target.'cfg(all(not(target_arch = "wasm32"), not(target_os = "android")))'.dependencies]
5545
glob = "0.3.1"

crates/bevy_plugin/src/plugin.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,9 @@ impl YarnApp for App {
236236
}
237237

238238
fn register_watching_for_changes(&mut self) -> &mut Self {
239-
let on_by_default = cfg!(all(not(target_arch = "wasm32"), not(target_os = "android")));
240-
241-
let asset_plugin = get_asset_plugin(self);
242-
let watching_for_changes = asset_plugin
243-
.watch_for_changes_override
244-
.unwrap_or(on_by_default);
239+
let asset_server = self.world.get_resource::<AssetServer>().expect(ASSET_ERROR);
245240

241+
let watching_for_changes = asset_server.watching_for_changes();
246242
self.insert_resource(WatchingForChanges(watching_for_changes))
247243
}
248244

@@ -256,9 +252,11 @@ impl YarnApp for App {
256252

257253
fn get_asset_plugin(app: &App) -> &AssetPlugin {
258254
let asset_plugins: Vec<&AssetPlugin> = app.get_added_plugins();
259-
asset_plugins.into_iter().next().expect("Yarn Spinner requires access to the Bevy asset plugin. \
260-
Please add `YarnSpinnerPlugin` after `AssetPlugin`, which is commonly added as part of the `DefaultPlugins`")
255+
asset_plugins.into_iter().next().expect(ASSET_ERROR)
261256
}
262257

258+
const ASSET_ERROR: &str = "Yarn Spinner requires access to the Bevy asset plugin. \
259+
Please add `YarnSpinnerPlugin` after `AssetPlugin`, which is commonly added as part of the `DefaultPlugins`";
260+
263261
#[derive(Debug, Clone, PartialEq, Eq, Hash, Resource)]
264262
pub(crate) struct AssetRoot(pub(crate) PathBuf);

0 commit comments

Comments
 (0)