Skip to content

Commit

Permalink
Remove resource_scope from starting context
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceeri committed Mar 11, 2024
1 parent f71152a commit 6964db0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions crates/bevy_gizmos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,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<Config, Clear>(world: &mut World)
pub fn start_gizmo_context<Config, Clear>(
mut swap: ResMut<GizmoStorage<Config, Swap<Clear>>>,
mut default: ResMut<GizmoStorage<Config, ()>>,
)
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
{
world.resource_scope(
|world: &mut World, mut swap: Mut<GizmoStorage<Config, Swap<Clear>>>| {
let mut default = world.resource_mut::<GizmoStorage<Config, ()>>();
default.swap(&mut *swap);
},
);
default.swap(&mut *swap);
}

/// End this gizmo clearing context.
Expand Down

0 comments on commit 6964db0

Please sign in to comment.