Fix(input focus): Bypass change detection in process_recorded_focus_changes#23765
Conversation
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
|
Strange, there seems to have been an error uploading the screenshots and that’s why the pixel-eagle comment is there: Anyway, it can probably be ignored? |
|
Aha, that's why! |
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Objective
Res<InputFocus>hasis_changed()returning true every frame becauseprocess_recorded_focus_changesmutates it every frame now. Other systems that were relying onInputFocus.is_changed()for when thecurrent_focuschanges are no longer working as intended because of that change.Solution
ResMut<InputFocus>is accessed inprocess_recorded_focus_changes.Testing
cargo run --example feathers --features=“experimental_bevy_feathers”: text cursor now blinks correctly againcargo run --example directional_navigationverified viaprintln!statement inupdate_focus_displaythat the system isn’t running on every frame (since it has a run condition.run_if(|input_focus: Res<InputFocus>| input_focus.is_changed()))