File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ use super::{
30
30
chunk:: { ChunkId , RenderChunk2dStorage } ,
31
31
draw:: DrawTilemapMaterial ,
32
32
pipeline:: { TilemapPipeline , TilemapPipelineKey } ,
33
+ prepare,
33
34
queue:: { ImageBindGroups , TilemapViewBindGroup } ,
34
35
} ;
35
36
@@ -127,7 +128,14 @@ where
127
128
. add_systems (
128
129
Render ,
129
130
(
130
- queue_material_tilemap_meshes :: < M > . in_set ( RenderSet :: Queue ) ,
131
+ // Ensure `queue_material_tilemap_meshes` runs after `prepare::prepare` because `prepare` calls `commands.spawn` with `ChunkId`
132
+ // and that data is then consumed by `queue_material_tilemap_mesh`. This is important because `prepare` is part of the `PrepareAssets`
133
+ // set. Bevy is loose on its expectation of when systems in the `PrepareAssets` set execute (for performance) and only needs them
134
+ // to run before the `Prepare` set (which is after Queue). This invites the possibility of an intermittent incorrect ordering dependent
135
+ // on the scheduler.
136
+ queue_material_tilemap_meshes :: < M >
137
+ . in_set ( RenderSet :: Queue )
138
+ . after ( prepare:: prepare) ,
131
139
bind_material_tilemap_meshes :: < M > . in_set ( RenderSet :: PrepareBindGroups ) ,
132
140
) ,
133
141
) ;
You can’t perform that action at this time.
0 commit comments