From 46fe7fd281d510ff12662e021d572aa0aa4012f3 Mon Sep 17 00:00:00 2001 From: Aceeri Date: Mon, 11 Mar 2024 10:32:20 -0700 Subject: [PATCH] Remove resource_scope from starting context --- crates/bevy_gizmos/src/lib.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 23b2c71bddd35..91372befbd33e 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -272,17 +272,15 @@ struct LineGizmoHandles { /// Internally this pushes the parent default context into a swap buffer. /// Gizmo contexts should be handled like a stack, so if you push a new context, /// you must pop the context before the parent context ends. -pub fn start_gizmo_context(world: &mut World) +pub fn start_gizmo_context( + mut swap: ResMut>>, + mut default: ResMut>, +) where Config: GizmoConfigGroup, Clear: 'static + Send + Sync, { - world.resource_scope( - |world: &mut World, mut swap: Mut>>| { - let mut default = world.resource_mut::>(); - default.swap(&mut *swap); - }, - ); + default.swap(&mut *swap); } /// End this gizmo clearing context.