Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/bevy_gizmos/src/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
color_from_entity,
config::{GizmoConfigGroup, GizmoConfigStore},
gizmos::Gizmos,
AppGizmoBuilder,
AppGizmoBuilder, GizmoMeshSystems,
};

/// A [`Plugin`] that provides visualization of [`Aabb`]s for debugging.
Expand All @@ -35,7 +35,8 @@ impl Plugin for AabbGizmoPlugin {
}),
)
.after(bevy_camera::visibility::VisibilitySystems::MarkNewlyHiddenEntitiesInvisible)
.after(TransformSystems::Propagate),
.after(TransformSystems::Propagate)
.before(GizmoMeshSystems),
);
}
}
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_gizmos/src/frustum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use crate::{
color_from_entity,
config::{GizmoConfigGroup, GizmoConfigStore},
gizmos::Gizmos,
AppGizmoBuilder,
AppGizmoBuilder, GizmoMeshSystems,
};

/// A [`Plugin`] that provides visualization of [`Frustum`]s for debugging.
Expand All @@ -69,7 +69,8 @@ impl Plugin for FrustumGizmoPlugin {
}),
)
.in_set(FrustumGizmoSystems)
.after(VisibilitySystems::UpdateFrusta),
.after(VisibilitySystems::UpdateFrusta)
.before(GizmoMeshSystems),
);
}
}
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_gizmos/src/gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ pub struct Swap<Clear>(PhantomData<Clear>);
/// cleared each time the [`RunFixedMainLoop`](bevy_app::RunFixedMainLoop)
/// schedule is run.
///
/// Gizmos should be spawned before the [`Last`](bevy_app::Last) schedule
/// Gizmos should be spawned before [`GizmoMeshSystems`](crate::GizmoMeshSystems)
/// are run in the [`PostUpdate`](bevy_app::PostUpdate) schedule
/// to ensure they are drawn.
///
/// To set up your own clearing context (useful for custom scheduling similar
Expand Down Expand Up @@ -134,7 +135,7 @@ pub struct Swap<Clear>(PhantomData<Clear>);
/// .add_systems(EndOfRun, collect_requested_gizmos::<DefaultGizmoConfigGroup, MyContext>)
/// .add_systems(EndOfMyContext, end_gizmo_context::<DefaultGizmoConfigGroup, MyContext>)
/// .add_systems(
/// Last,
/// PostUpdate,
/// propagate_gizmos::<DefaultGizmoConfigGroup, MyContext>.before(GizmoMeshSystems),
/// );
/// }
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_gizmos/src/global.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Mutex;

use bevy_app::{App, Last, Plugin};
use bevy_app::{App, Plugin, PostUpdate};
use bevy_ecs::schedule::IntoScheduleConfigs;

use crate::{
Expand All @@ -17,7 +17,7 @@ pub struct GlobalGizmosPlugin;

impl Plugin for GlobalGizmosPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Last, flush_global_gizmos.before(GizmoMeshSystems));
app.add_systems(PostUpdate, flush_global_gizmos.before(GizmoMeshSystems));
}
}

Expand Down
14 changes: 8 additions & 6 deletions crates/bevy_gizmos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub mod prelude {
};
}

use bevy_app::{App, FixedFirst, FixedLast, Last, Plugin, RunFixedMainLoop};
use bevy_asset::{Asset, AssetApp, Assets, Handle};
use bevy_app::{App, FixedFirst, FixedLast, Plugin, PostUpdate, RunFixedMainLoop};
use bevy_asset::{Asset, AssetApp, AssetEventSystems, Assets, Handle};
use bevy_color::{Color, Oklcha};
use bevy_ecs::{
prelude::Entity,
Expand Down Expand Up @@ -101,7 +101,8 @@ impl Plugin for GizmoPlugin {
app.init_asset::<GizmoAsset>()
.init_resource::<GizmoHandles>()
// We insert the Resource GizmoConfigStore into the world implicitly here if it does not exist.
.init_gizmo_group::<DefaultGizmoConfigGroup>();
.init_gizmo_group::<DefaultGizmoConfigGroup>()
.configure_sets(PostUpdate, GizmoMeshSystems.before(AssetEventSystems));

app.add_plugins((
aabb::AabbGizmoPlugin,
Expand Down Expand Up @@ -164,10 +165,11 @@ impl AppGizmoBuilder for App {
.in_set(bevy_app::RunFixedMainLoopSystems::AfterFixedMainLoop),
)
.add_systems(
Last,
PostUpdate,
(
propagate_gizmos::<Config, Fixed>.before(GizmoMeshSystems),
update_gizmo_meshes::<Config>.in_set(GizmoMeshSystems),
update_gizmo_meshes::<Config>
.in_set(GizmoMeshSystems),
),
);

Expand Down Expand Up @@ -225,7 +227,7 @@ pub fn start_gizmo_context<Config, Clear>(
///
/// Pop the default gizmos context out of the [`Swap<Clear>`] gizmo storage.
///
/// This must be called before [`GizmoMeshSystems`] in the [`Last`] schedule.
/// This must be called before [`GizmoMeshSystems`] in the [`PostUpdate`] schedule.
pub fn end_gizmo_context<Config, Clear>(
mut swap: ResMut<GizmoStorage<Config, Swap<Clear>>>,
mut default: ResMut<GizmoStorage<Config, ()>>,
Expand Down
Loading