Skip to content

Commit

Permalink
Fix race condition on option despawning
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Jan 23, 2024
1 parent d0f31f5 commit 021f0fc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/example_dialogue_view/src/option_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fn show_options(
}

fn select_option(
line_events: EventReader<PresentLineEvent>,
dialogue_complete_events: EventReader<DialogueCompleteEvent>,
keys: Res<Input<KeyCode>>,
typewriter: Res<Typewriter>,
Expand Down Expand Up @@ -118,8 +117,7 @@ fn select_option(
dialogue_runner.select_option(id).unwrap();
}
}
let should_despawn =
has_selected_id || !line_events.is_empty() || !dialogue_complete_events.is_empty();
let should_despawn = has_selected_id || !dialogue_complete_events.is_empty();
if should_despawn {
commands.remove_resource::<OptionSelection>();
let (entity, mut style, mut visibility) = options_node.single_mut();
Expand Down

0 comments on commit 021f0fc

Please sign in to comment.