Skip to content

Commit 40e6f12

Browse files
Don't assume entity still exists for ScenePatch AssetEvent (#40)
1 parent 22a2731 commit 40e6f12

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/bevy_scene2/src/spawn.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ pub fn spawn_queued(
9696
};
9797

9898
for entity in entities {
99-
let mut entity_mut = world.get_entity_mut(entity).unwrap();
100-
scene.spawn(&mut entity_mut).unwrap();
99+
if let Ok(mut entity_mut) = world.get_entity_mut(entity) {
100+
scene.spawn(&mut entity_mut).unwrap();
101+
}
101102
}
102103
}
103104
}

0 commit comments

Comments
 (0)