bevy
bevy copied to clipboard
Change relevant methods in World and co to return ResMut
Objective
- Fixes #11765
Solution
- Changed the current implementations to use
ResMutinstead ofMut
Changelog
- In
World:resource_mut,get_resource_mut,get_resource_or_insert_withnow returnResMut/Option<ResMut>andresource_scopenow accepts a function parameter of typeimpl FnOnce(&mut World, ResMut<R>) -> U - In
UnsafeWorldCell:get_resource_mutnow returnsOption<ResMut> - Changed internal uses of these methods to use
ResMutaswell. -
ResMut<R>now implementsFrom<Mut<R: Resource>>
Migration Guide
- For most use cases this should not require any action besides changing
Mut<T>toResMut<T>since they are very similar to each other andMut<T>implementsFrom<ResMut<'w, T>> for Mut<'w, T>. But you could just call.into()if any problems arise.