Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Once Actions

Once actions are actions that run a system exactly once and then complete. They are useful for one-time operations like sending events, modifying resources, or performing state transitions.

Available Once Actions

  • run - Run a system once
  • event - Send an event once
  • res - Modify a resource once
  • non_send - Modify a non-send resource once
  • switch - Switch between actions based on a condition
  • state - Transition to a new state once
  • audio - Play audio once

Each action is designed to be used with the Reactor::schedule or task.will methods to schedule a one-time operation.

Basic Usage

#![allow(unused)]
fn main() {
use bevy::prelude::*;
use bevy_flurx::prelude::*;

// Run a system once during the Update schedule
Reactor::schedule(|task| async move {
    task.will(Update, once::run(|world: &mut World| {
        // Do something once
    })).await;
});
}

The once actions are part of the core functionality of bevy_flurx, providing simple building blocks for more complex action sequences.