#Using tokio::spawn w/ Bevy

6 messages · Page 1 of 1 (latest)

graceful geyser
#

Hi, I'm trying spawn an async task in a Startup system using

tokio::spawn(async move { ... })

but I'm getting the error:

there is no reactor running, must be called from the context of a Tokio 1.x runtime

My main is annotated:

#[tokio::main]
async fn main() { ... }

I read on Reddit that it could be an issue with different Tokio versions, but my cargo tree looks fine(?):

cargo tree | grep tokio
│   ├── tokio v1.35.1
│   │   └── tokio-macros v2.2.0 (proc-macro)
│       │   ├── tokio v1.35.1 (*)
│       ├── tokio v1.35.1 (*)
│   ├── tokio v1.35.1 (*)
│   ├── tokio-tungstenite v0.21.0
│   │   ├── tokio v1.35.1 (*)
├── tokio v1.35.1 (*)
├── tokio-tungstenite v0.21.0 (*)
├── tokio-tungstenite-wasm v0.2.1
│   ├── tokio v1.35.1 (*)
│   └── tokio-tungstenite v0.20.1
│       ├── tokio v1.35.1 (*)

I imagine it's something very simple but I'm not even sure where to begin.

wet merlin
#

The problem is that bevy doesn't use tokio for its async runtime

hearty iron
hearty iron