#Do I need to do anything special before manually running system?

7 messages · Page 1 of 1 (latest)

spring iris
#

I want to store a system in a component and then run it from an exclusive system. Something like this:

#[derive(Component)]
struct Action(BoxedSystem);

fn perform_actions(world: &mut World) {
    // ... get the component ...
    action.0.run((), world);
}

Is this OK? Is it valid to just call run like that? Do I need to do something special to prepare or initialize the system first?

pliant dagger
#

Bump, interested in this too

spring iris
#

to answer my own question

#

YES

#

systems need to be "initialized" first

#

and a system must be run on the same World it was initialized with

#

so my code now looks something like this