Open
Description
What problem does this solve or what need does it fill?
EntityWorldMut
mirrors many of the methods on World
, but not all of them. One of the methods it does not mirror is resource_scope
. If you need to use resource_scope
in a context where you have an EntityWorldMut
, such as an EntityCommand
, you currently need to deconstruct and then reconstruct it like so:
let id = entity_world_mut.id();
let world = entity_world_mut.into_world_mut();
world.resource_scope::<_, _>(|world, res| {
let entity_world_mut = world.entity_mut(id);
/* ... */
});
What solution would you like?
Add resource_scope
and try_resource_scope
methods to EntityWorldMut
that mirror the corresponding methods on World
.
What alternative(s) have you considered?
- Change methods like
EntityCommand::apply
,BundleEffect::apply
, and anything else that takes anEntityWorldMut
as a parameter, to instead separately take anEntity
and a&mut World
as parameters. - Continue using the aforementioned workaround.