use bevy::{asset::AssetServerSettings, prelude::*};
use super::WebAssetIo;
pub struct WebAssetPlugin;
impl Plugin for WebAssetPlugin {
fn build(&self, app: &mut App) {
let watch_for_changes_configured = app
.world
.get_resource::<AssetServerSettings>()
.map(|s| s.watch_for_changes)
.unwrap_or(false);
if watch_for_changes_configured {
warn!("bevy_web_asset currently breaks regular filesystem hot reloading, see https://github.com/johanhelsing/bevy_web_asset/issues/1");
}
let asset_io = {
let default_io = bevy::asset::create_platform_default_asset_io(app);
WebAssetIo { default_io }
};
app.insert_resource(AssetServer::new(asset_io));
}
}