Fix ambiguous queue_material_tilemap_meshes
ordering
#523
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was possible for
queue_material_tilemap_meshes
to run prior toprepare
which would result in nothing rendering.This would only occur in scenarios where other code inserted a system dependent on
mut commands: Commands
into theQueue
set. Thebevy-egui
library was doing so and was thus introducing behavior wherebevy-ecs-tilemap
would intermittently not render anything due to improper system ordering.Fixes: #521
Additional Details
djeedai/bevy_hanabi#297 Bevy Hanabi experienced a similar issue. Their fix looks similar to this proposed fix.
The Bevy notes hint that this sort of change is necessary, too:
This is not directly an issue with automatically applying command buffers. It is related, but the key issue here is one of improper system ordering. The existing codebase happened to work but was not guaranteed to work. It worked only because the scheduler was choosing to resolve ambiguous system ordering in a way which was compatible with
bevy_ecs_tilemap
architecture. This invited the problem where third party code could introduce systems that would affect the scheduler's ordering decision and result in rendering failures.