mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Add RenderSet::FinalCleanup
for World::clear_entities
(#14764)
# Objective `World::clear_entities` is ambiguous with all of the other systems in `RenderSet::Cleanup` because it access `&mut World`. ## Solution I've added another system set variant, and made sure that this runs after everything else. ## Testing The `ambiguity_detection` example ## Migration Guide `World::clear_entities` is now part of `RenderSet::PostCleanup` rather than `RenderSet::Cleanup`. Your cleanup systems should likely stay in `RenderSet::Cleanup`. ## Additional context Spotted when working on #7386: this was responsible for a large number of ambiguities. This should be removed if / when #14449 is merged: there's no need to call `clear_entities` at all if the rendering world is retained!
This commit is contained in:
parent
ac29bdfc86
commit
a2fc9de16d
1 changed files with 6 additions and 2 deletions
|
@ -104,7 +104,6 @@ pub struct RenderPlugin {
|
||||||
|
|
||||||
/// The systems sets of the default [`App`] rendering schedule.
|
/// The systems sets of the default [`App`] rendering schedule.
|
||||||
///
|
///
|
||||||
/// that runs immediately after the matching system set.
|
|
||||||
/// These can be useful for ordering, but you almost never want to add your systems to these sets.
|
/// These can be useful for ordering, but you almost never want to add your systems to these sets.
|
||||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||||
pub enum RenderSet {
|
pub enum RenderSet {
|
||||||
|
@ -138,6 +137,10 @@ pub enum RenderSet {
|
||||||
Render,
|
Render,
|
||||||
/// Cleanup render resources here.
|
/// Cleanup render resources here.
|
||||||
Cleanup,
|
Cleanup,
|
||||||
|
/// Final cleanup occurs: all entities will be despawned.
|
||||||
|
///
|
||||||
|
/// Runs after [`Cleanup`](RenderSet::Cleanup).
|
||||||
|
PostCleanup,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The main render schedule.
|
/// The main render schedule.
|
||||||
|
@ -162,6 +165,7 @@ impl Render {
|
||||||
Prepare,
|
Prepare,
|
||||||
Render,
|
Render,
|
||||||
Cleanup,
|
Cleanup,
|
||||||
|
PostCleanup,
|
||||||
)
|
)
|
||||||
.chain(),
|
.chain(),
|
||||||
);
|
);
|
||||||
|
@ -469,7 +473,7 @@ unsafe fn initialize_render_app(app: &mut App) {
|
||||||
render_system,
|
render_system,
|
||||||
)
|
)
|
||||||
.in_set(RenderSet::Render),
|
.in_set(RenderSet::Render),
|
||||||
World::clear_entities.in_set(RenderSet::Cleanup),
|
World::clear_entities.in_set(RenderSet::PostCleanup),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue