Skip to content

Instantly share code, notes, and snippets.

@samcarey
samcarey / bevy_wasm_async_worker_example.rs
Last active March 23, 2023 17:56
An example of how to set up an async worker with Bevy targetting WASM. This assumes that there's a server running at the specified URL that will respond.
use std::future::Future;
use bevy::{core::FixedTimestep, prelude::*, tasks::AsyncComputeTaskPool};
use bevy_egui::{egui, EguiContext, EguiPlugin};
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
#[bevy_main]
fn main() {
let mut app = App::new();