diff --git a/crates/bevy_ecs/src/world/deferred_world.rs b/crates/bevy_ecs/src/world/deferred_world.rs index 581f1af25e71e..c140e9dcf39a9 100644 --- a/crates/bevy_ecs/src/world/deferred_world.rs +++ b/crates/bevy_ecs/src/world/deferred_world.rs @@ -361,6 +361,10 @@ impl<'w> DeferredWorld<'w> { /// Use [`get_resource_mut`](DeferredWorld::get_resource_mut) instead if you want to handle this case. #[inline] #[track_caller] + #[deprecated( + since = "0.16.0", + note = "Please use `get_resource_mut` instead, which returns an `Option` instead of panicking." + )] pub fn resource_mut(&mut self) -> Mut<'_, R> { match self.get_resource_mut() { Some(x) => x, @@ -391,6 +395,10 @@ impl<'w> DeferredWorld<'w> { /// This function will panic if it isn't called from the same thread that the resource was inserted from. #[inline] #[track_caller] + #[deprecated( + since = "0.16.0", + note = "Please use `get_non_send_resource_mut` instead, which returns an `Option` instead of panicking." + )] pub fn non_send_resource_mut(&mut self) -> Mut<'_, R> { match self.get_non_send_resource_mut() { Some(x) => x, diff --git a/crates/bevy_ecs/src/world/entity_ref.rs b/crates/bevy_ecs/src/world/entity_ref.rs index b4fe20b3a4d3d..9ff1483e16839 100644 --- a/crates/bevy_ecs/src/world/entity_ref.rs +++ b/crates/bevy_ecs/src/world/entity_ref.rs @@ -1328,6 +1328,10 @@ impl<'w> EntityWorldMut<'w> { /// /// Panics if the resource does not exist. /// Use [`get_resource`](EntityWorldMut::get_resource) instead if you want to handle this case. + #[deprecated( + since = "0.16.0", + note = "Please use `get_resource` instead, which returns an `Option` instead of panicking." + )] #[inline] #[track_caller] pub fn resource(&self) -> &R { @@ -1345,6 +1349,10 @@ impl<'w> EntityWorldMut<'w> { /// use [`get_resource_or_insert_with`](World::get_resource_or_insert_with). #[inline] #[track_caller] + #[deprecated( + since = "0.16.0", + note = "Please use `get_resource_mut` instead, which returns an `Option` instead of panicking." + )] pub fn resource_mut(&mut self) -> Mut<'_, R> { self.world.resource_mut::() } diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 294145de23049..a98eb31ef86f4 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -1850,6 +1850,10 @@ impl World { /// use [`get_resource_or_insert_with`](World::get_resource_or_insert_with). #[inline] #[track_caller] + #[deprecated( + since = "0.16.0", + note = "Please use `get_resource` instead, which returns an `Option` instead of panicking." + )] pub fn resource(&self) -> &R { match self.get_resource() { Some(x) => x, @@ -1874,6 +1878,10 @@ impl World { /// use [`get_resource_or_insert_with`](World::get_resource_or_insert_with). #[inline] #[track_caller] + #[deprecated( + since = "0.16.0", + note = "Please use `get_resource_ref` instead, which returns an `Option` instead of panicking." + )] pub fn resource_ref(&self) -> Ref { match self.get_resource_ref() { Some(x) => x, @@ -1898,6 +1906,10 @@ impl World { /// use [`get_resource_or_insert_with`](World::get_resource_or_insert_with). #[inline] #[track_caller] + #[deprecated( + since = "0.16.0", + note = "Please use `get_resource_mut` instead, which returns an `Option` instead of panicking." + )] pub fn resource_mut(&mut self) -> Mut<'_, R> { match self.get_resource_mut() { Some(x) => x,