Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions crates/bevy_asset/src/io/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ use tracing::warn;
/// Example usage:
///
/// ```rust
/// # use bevy_app::{App, Startup};
/// # use bevy_ecs::prelude::{Commands, Res};
/// # use bevy_asset::web::{WebAssetPlugin, AssetServer};
/// # use bevy_app::{App, Startup, TaskPoolPlugin};
/// # use bevy_ecs::prelude::{Commands, Component, Res};
/// # use bevy_asset::{Asset, AssetApp, AssetPlugin, AssetServer, Handle, io::web::WebAssetPlugin};
/// # use bevy_reflect::TypePath;
/// # struct DefaultPlugins;
/// # impl DefaultPlugins { fn set(plugin: WebAssetPlugin) -> WebAssetPlugin { plugin } }
/// # use bevy_asset::web::AssetServer;
/// # impl DefaultPlugins { fn set(&self, plugin: WebAssetPlugin) -> WebAssetPlugin { plugin } }
/// # #[derive(Asset, TypePath, Default)]
/// # struct Image;
/// # #[derive(Component)]
/// # struct Sprite;
/// # impl Sprite { fn from_image(_: Handle<Image>) -> Self { Sprite } }
/// # fn main() {
/// App::new()
/// # .add_plugins((TaskPoolPlugin::default(), AssetPlugin::default()))
Copy link
Contributor

@kfc35 kfc35 Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a comment on line 14 that says:
"/// NOTE: Make sure to add this plugin *before* AssetPlugin to properly register http asset sources.”
Does this line contradict that statement? The App is now WebAssetPlugin later than AssetPlugin if I’m interpreting this correctly

/// # .init_asset::<Image>()
Copy link
Contributor

@kfc35 kfc35 Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d also assume you’d init the asset after adding the WebAssetPlugin… but I may be mistaken!

/// .add_plugins(DefaultPlugins.set(WebAssetPlugin {
/// silence_startup_warning: true,
/// }))
Expand Down