-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
added ability to get Res<T>
from World
with World::get_resource_ref
#11561
Conversation
Let's keep this split this out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just some minor comments on wording.
CI failure is real, but doesn't seem related to your PR.
|
it is? |
Head branch was pushed to by a user without write access
yup, should be fixed now |
…ref` (bevyengine#11561) # Objective It's sometimes desirable to get a `Res<T>` rather than `&T` from `World::get_resource`. Alternative to bevyengine#9940, partly adresses bevyengine#9926 ## Solution added additional methods to `World` and `UnsafeWorldCell` to retrieve a resource wrapped in a `Res`. - `UnsafeWorldCell::get_resource_ref` - `World::get_resource_ref` - `World::resource_ref` I can change it so `World::resource_mut` returns `ResMut` instead of `Mut` as well if that's desired, but that could also be added later in a seperate pr. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Mike <mike.hsu@gmail.com> Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
Objective
It's sometimes desirable to get a
Res<T>
rather than&T
fromWorld::get_resource
.Alternative to #9940, partly adresses #9926
Solution
added additional methods to
World
andUnsafeWorldCell
to retrieve a resource wrapped in aRes
.UnsafeWorldCell::get_resource_ref
World::get_resource_ref
World::resource_ref
I can change it so
World::resource_mut
returnsResMut
instead ofMut
as well if that's desired, but that could also be added later in a seperate pr.