Commands
Command Registration
fn spawn_dialogue_runner(mut commands: Commands, project: Res<YarnProject>) {
let mut dialogue_runner = project.create_dialogue_runner();
// Add our custom command to the dialogue runner
dialogue_runner
.commands_mut()
.add_command("print_addition", commands.register_system(print_addition));
dialogue_runner.start_node("Start");
commands.spawn(dialogue_runner);
}
fn print_addition(In((a, b)): In<(f32, f32)>) {
print!("{a} + {b} = {c}", c = a + b)
}title: Start
---
Let's print the addition of 1 and 3 in the console:
<<print_addition 1 3>>
===Return Types and Long Running Commands
Last updated
Was this helpful?
