Skip to content

Commit

Permalink
Don't add EguiContext to every entity (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGriffin91 authored Nov 25, 2024
1 parent 509f61f commit fa39656
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ impl Plugin for EguiPlugin {
PreStartup,
(
setup_new_windows_system,
#[cfg(feature = "render")]
setup_render_to_texture_handles_system,
apply_deferred,
update_contexts_system,
Expand All @@ -706,6 +707,7 @@ impl Plugin for EguiPlugin {
PreUpdate,
(
setup_new_windows_system,
#[cfg(feature = "render")]
setup_render_to_texture_handles_system,
apply_deferred,
update_contexts_system,
Expand Down Expand Up @@ -922,17 +924,15 @@ pub fn setup_new_windows_system(
));
}
}

/// Adds bevy_egui components to newly created windows.
#[cfg(feature = "render")]
pub fn setup_render_to_texture_handles_system(
mut commands: Commands,
#[cfg(feature = "render")] new_render_to_texture_targets: Query<
new_render_to_texture_targets: Query<
Entity,
(Added<EguiRenderToTextureHandle>, Without<EguiContext>),
>,
#[cfg(not(feature = "render"))] new_render_to_texture_targets: Query<
Entity,
Without<EguiContext>,
>,
) {
for render_to_texture_target in new_render_to_texture_targets.iter() {
commands.entity(render_to_texture_target).insert((
Expand Down

0 comments on commit fa39656

Please sign in to comment.