bevy/crates/bevy_asset/Cargo.toml
Carter Anderson 98938a8555 Internal Asset Hot Reloading (#3966)
Adds "hot reloading" of internal assets, which is normally not possible because they are loaded using `include_str` / direct Asset collection access.

This is accomplished via the following:
* Add a new `debug_asset_server` feature flag
* When that feature flag is enabled, create a second App with a second AssetServer that points to a configured location (by default the `crates` folder). Plugins that want to add hot reloading support for their assets can call the new `app.add_debug_asset::<T>()` and `app.init_debug_asset_loader::<T>()` functions.
* Load "internal" assets using the new `load_internal_asset` macro. By default this is identical to the current "include_str + register in asset collection" approach. But if the `debug_asset_server` feature flag is enabled, it will also load the asset dynamically in the debug asset server using the file path. It will then set up a correlation between the "debug asset" and the "actual asset" by listening for asset change events.

This is an alternative to #3673. The goal was to keep the boilerplate and features flags to a minimum for bevy plugin authors, and allow them to home their shaders near relevant code. 

This is a draft because I haven't done _any_ quality control on this yet. I'll probably rename things and remove a bunch of unwraps. I just got it working and wanted to use it to start a conversation.

Fixes #3660
2022-02-18 22:56:57 +00:00

48 lines
1.4 KiB
TOML

[package]
name = "bevy_asset"
version = "0.6.0"
edition = "2021"
description = "Provides asset functionality for Bevy Engine"
homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy"]
[features]
default = []
filesystem_watcher = ["notify"]
debug_asset_server = ["filesystem_watcher"]
[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.6.0" }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.6.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
bevy_log = { path = "../bevy_log", version = "0.6.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.6.0", features = ["bevy"] }
bevy_tasks = { path = "../bevy_tasks", version = "0.6.0" }
bevy_utils = { path = "../bevy_utils", version = "0.6.0" }
# other
serde = { version = "1", features = ["derive"] }
crossbeam-channel = "0.5.0"
anyhow = "1.0.4"
thiserror = "1.0"
downcast-rs = "1.2.0"
notify = { version = "=5.0.0-pre.11", optional = true }
parking_lot = "0.11.0"
rand = "0.8.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2" }
web-sys = { version = "0.3", features = ["Request", "Window", "Response"] }
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
[target.'cfg(target_os = "android")'.dependencies]
ndk-glue = { version = "0.5" }
[dev-dependencies]
futures-lite = "1.4.0"
tempfile = "3.2.0"
bevy_core = { path = "../bevy_core", version = "0.6.0" }