Skip to content

Commit

Permalink
better flush
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRawMeatball committed Jul 31, 2022
1 parent 0149c41 commit dcaefaf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ impl Plugin for RenderPlugin {
// flushing as "invalid" ensures that app world entities aren't added as "empty archetype" entities by default
// these entities cannot be accessed without spawning directly onto them
// this _only_ works as expected because clear_entities() is called at the end of every frame.
unsafe { render_app.world.entities_mut() }.flush_as_invalid();

// flushing with a no-op instead of setting the ArchetypeId to invalid as with flush_as_invalid is safe because
// the current state of `Entities` ensures that the code path taken will initialize this way
unsafe { render_app.world.entities_mut().flush(|_, _| {}) };
}

{
Expand Down

0 comments on commit dcaefaf

Please sign in to comment.