mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
try_insert NoAutomaticBatching (#12396)
# Objective fix occasional crash from commands.insert when quickly spawning and despawning skinned/morphed meshes ## Solution use `try_insert` instead of `insert`. if the entity is deleted we don't mind failing to add the `NoAutomaticBatching` marker.
This commit is contained in:
parent
8a08825348
commit
cca4ab3663
2 changed files with 2 additions and 2 deletions
|
@ -109,6 +109,6 @@ pub fn no_automatic_morph_batching(
|
|||
query: Query<Entity, (With<MeshMorphWeights>, Without<NoAutomaticBatching>)>,
|
||||
) {
|
||||
for entity in &query {
|
||||
commands.entity(entity).insert(NoAutomaticBatching);
|
||||
commands.entity(entity).try_insert(NoAutomaticBatching);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,6 +146,6 @@ pub fn no_automatic_skin_batching(
|
|||
query: Query<Entity, (With<SkinnedMesh>, Without<NoAutomaticBatching>)>,
|
||||
) {
|
||||
for entity in &query {
|
||||
commands.entity(entity).insert(NoAutomaticBatching);
|
||||
commands.entity(entity).try_insert(NoAutomaticBatching);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue