docs/bevy/release-content/migration-guides/RenderDebugOverlay_optional_keybindings.md 1.1 K · 39 lines · raw · history

1 ---
2 title: RenderDebugOverlay added to default plugins and now has optional keybindings
3 pull_requests: [24891]
4 ---
5
6 RenderDebugOverlay is now added to the default plugins, disabled by default. enable it below with the default keybindings:
7
8 ```rust
9 App::new()
10 .add_plugins(DefaultPlugins)
11 .insert_resource(RenderDebugOverlayKeybindings {
12 enable_keybindings: true,
13 ..Default::default()
14 })
15 ```
16
17 keybindings are set to `KeyCode::F1` for cycling modes and `KeyCode::F2` for cycling opacity by default.
18
19 keybindings are configurable during runtime by changing the `RenderDebugOverlay` resource:
20
21 ```rust
22 App::new()
23 .add_plugins(DefaultPlugins)
24 .insert_resource(RenderDebugOverlayKeybindings {
25 enable_keybindings: true,
26 cycle_mode: KeyCode::F3,
27 cycle_opacity: KeyCode::F4,
28 })
29 ```
30
31 Keybindings can be changed at runtime, for example:
32
33 ```rust
34 fn change_keybindings(mut keybindings: ResMut<RenderDebugOverlayKeybindings>) {
35 keybindings.enable_keybindings = true;
36 keybindings.cycle_mode = KeyCode::F5;
37 keybindings.cycle_opacity = KeyCode::F6;
38 }
39 ```