#Custom command await / async

5 messages · Page 1 of 1 (latest)

boreal spade
#

Hi everyone,
is there a way to run custom commands async to wait until the command is finished, like in js?

fn startup( mut commands: Commands, ) { await commands.custom(); println!("Done"); }

strange mulch
#

Sure, you can use a task - the examples on tasks can technically be entirely done within commands

#

But I would hesitate to do anything like that - Commands are specifically designed to block the world for the least possible amount of time, and waiting on anything within one defeats that

versed sapphire
#

bevy_defer is exactly made for this use case 🙂

cursive pine
#

I'll also throw in bevy_mod_async. Not as fancy as bevy_defer, but similar problem space