Skip to content

Mention migration for EntityCommand::apply #2067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janhohenheim opened this issue Apr 3, 2025 · 4 comments · Fixed by #2069
Closed

Mention migration for EntityCommand::apply #2067

janhohenheim opened this issue Apr 3, 2025 · 4 comments · Fixed by #2069
Assignees
Milestone

Comments

@janhohenheim
Copy link
Member

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().

@alice-i-cecile
Copy link
Member

Note that the .id() API call is a bit strange; I would have expected the method to be called .entity()

This is consistent with the EntityCommands API :)

@alice-i-cecile alice-i-cecile self-assigned this Apr 3, 2025
@janhohenheim
Copy link
Member Author

@alice-i-cecile fair enough! Then I consider that API strange as well :P No big deal though :)

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Apr 3, 2025

@alice-i-cecile
Copy link
Member

Done in bevyengine/bevy#17215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants