Don't add transforms to non-existent entities.
This commit is contained in:
parent
865bdc333c
commit
0774599ef4
|
@ -39,11 +39,17 @@ 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 {
|
for entity in &mut removed {
|
||||||
|
if transforms.get(entity).is_ok() {
|
||||||
commands.entity(entity).insert(TransformBundle::default());
|
commands.entity(entity).insert(TransformBundle::default());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct VolumetricPlugin;
|
pub struct VolumetricPlugin;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user