Skip to content

Commit f610259

Browse files
fix(mesh2d): replace unwrap by error log in specialize system (#20677)
# Objective prevent panics talked about in #19064 this a “temporary” fix to get in 0.17, until the above PR is finalized, and the source problem is fixed. ## Solution remove the unwrap ## Testing - anything is better than panic - been using this patch in my own games for months without any apparent issue ## Note please improve the actual error missing if needed, i doubt its perfect --------- Co-authored-by: Alice Cecile <[email protected]>
1 parent 69745d4 commit f610259

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/bevy_sprite_render/src/mesh2d/material.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,10 @@ pub fn specialize_material2d_meshes<M: Material2d>(
737737
let Some(mesh_instance) = render_mesh_instances.get_mut(visible_entity) else {
738738
continue;
739739
};
740-
let entity_tick = entity_specialization_ticks.get(visible_entity).unwrap();
740+
let Some(entity_tick) = entity_specialization_ticks.get(visible_entity) else {
741+
error!("{visible_entity:?} is missing specialization tick. Spawning Meshes in PostUpdate or later is currently not fully supported.");
742+
continue;
743+
};
741744
let last_specialized_tick = view_specialized_material_pipeline_cache
742745
.get(visible_entity)
743746
.map(|(tick, _)| *tick);

0 commit comments

Comments
 (0)