use bevy::{prelude::*, DefaultPlugins}; use bevy_wasm_scripting::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugin(WasmPlugin) .init_resource::() .add_startup_system(load_wat_file) .add_system(confirm_compiled) .run(); } #[derive(Resource, Default)] struct State { handle: Handle, } fn load_wat_file(mut state: ResMut, asset_server: Res) { state.handle = asset_server.load("add_one.wat"); } fn confirm_compiled(state: Res, wasm_scripts: ResMut>) { let wasm_script = wasm_scripts.get(&state.handle); if wasm_script.is_none() { return; } info!("Loaded: {:?}", wasm_script.unwrap()); }