Skip to content

Mention migration for EntityCommand::apply #2067

@janhohenheim

Description

@janhohenheim

Before:

struct Foo;

impl EntityCommand for Foo {
    fn apply(self, entity: Entity, world: &mut World) {
        world
            .run_system_cached_with(print_entity, entity)
            .unwrap();
    }
}

fn print_entity(In(entity): In<Entity>) {
    info!("entity: {entity}");
}

After:

struct Foo;

impl EntityCommand for Foo {
    fn apply(self, entity_world: EntityWorldMut) {
        let entity = entity_world.id();
        entity_world
            .into_world_mut()
            .run_system_cached_with(print_entity, entity)
            .unwrap();
    }
}

fn print_entity(In(entity): In<Entity>) {
    info!("entity: {entity}");
}

I failed to find the commit that changed this, so other related methods may also have been changed.
Note that the .id() API call is a bit strange; I would have expected the method to be called .entity().

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions