Don't add transforms to non-existent entities.
This commit is contained in:
parent
865bdc333c
commit
0774599ef4
|
@ -39,9 +39,15 @@ fn update(
|
|||
}
|
||||
}
|
||||
|
||||
fn removed(mut commands: Commands, mut removed: RemovedComponents<Volumetric>) {
|
||||
fn removed(
|
||||
mut commands: Commands,
|
||||
mut removed: RemovedComponents<Volumetric>,
|
||||
transforms: Query<Entity, (With<Transform>, With<GlobalTransform>)>,
|
||||
) {
|
||||
for entity in &mut removed {
|
||||
commands.entity(entity).insert(TransformBundle::default());
|
||||
if transforms.get(entity).is_ok() {
|
||||
commands.entity(entity).insert(TransformBundle::default());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user