Fix `.meta` files not found error on web

copygirl 1 month ago
parent 54615c265d
commit 8eb1784260
  1. 33
      client/src/main.rs

@ -1,6 +1,7 @@
use bevy::prelude::*; use bevy::prelude::*;
use common::network::*; use common::network::*;
use bevy::asset::AssetMetaCheck;
use bevy::window::WindowResolution; use bevy::window::WindowResolution;
use lightyear::prelude::server::Started; use lightyear::prelude::server::Started;
@ -19,20 +20,26 @@ fn main() -> Result {
let cli = Args::parse(); let cli = Args::parse();
let mut app = App::new(); let mut app = App::new();
app.add_plugins(DefaultPlugins.set(WindowPlugin { app.add_plugins(DefaultPlugins
primary_window: Some(Window { .set(WindowPlugin {
title: "bevy-bloxel-classic".into(), primary_window: Some(Window {
// Steam Deck: DPI appears pretty high, causing everything to be scaled up. title: "bevy-bloxel-classic".into(),
// Setting `scale_factor_override` prevents this from happening. // Steam Deck: DPI appears pretty high, causing everything to be scaled up.
resolution: WindowResolution::new(1280, 720).with_scale_factor_override(1.0), // Setting `scale_factor_override` prevents this from happening.
// WEB: Fit canvas to parent element, so `Window` resizes automatically. resolution: WindowResolution::new(1280, 720).with_scale_factor_override(1.0),
fit_canvas_to_parent: true, // WEB: Fit canvas to parent element, so `Window` resizes automatically.
// WEB: Don't override default event handling like browser hotkeys while focused. fit_canvas_to_parent: true,
prevent_default_event_handling: false, // WEB: Don't override default event handling like browser hotkeys while focused.
prevent_default_event_handling: false,
..default()
}),
..default() ..default()
}), })
..default() .set(AssetPlugin {
})); // WEB: Don't check for `.meta` files since we don't use them.
meta_check: AssetMetaCheck::Never,
..default()
}));
// Fixes issue on web where the cursor isn't ungrabbed properly. // Fixes issue on web where the cursor isn't ungrabbed properly.
app.add_plugins(bevy_fix_cursor_unlock_web::FixPointerUnlockPlugin); app.add_plugins(bevy_fix_cursor_unlock_web::FixPointerUnlockPlugin);

Loading…
Cancel
Save