pub trait ActionsProxy<'a> {
    type Modifier: ModifyActions;

    fn actions(&'a mut self, entity: Entity) -> Self::Modifier;
}
Expand description

Proxy method for modifying actions. Returns a type that implements ModifyActions.

Warning

Do not modify actions using World inside the implementation of an Action. Actions need to be properly queued, which is what ActionCommands does. If you need to use World for modifying actions, use EntityActions::custom.

struct EmptyAction;

impl Action for EmptyAction {
    fn on_start(&mut self, entity: Entity, world: &mut World, commands: &mut ActionCommands) {
        // Bad
        world.actions(entity).finish();

        // Good
        commands.actions(entity).finish();

        // Also good
        commands.actions(entity).custom(move |w: &mut World| {
            w.actions(entity).finish();
        });
    }

    fn on_stop(&mut self, entity: Entity, world: &mut World, reason: StopReason) {}
}

Required Associated Types

The type returned for modifying actions.

Required Methods

Returns Self::Modifier for specified Entity.

Implementations on Foreign Types

Implementors