From 7d83aa2c578bc2c0684ba9087b4e23bb9cf831c4 Mon Sep 17 00:00:00 2001 From: Kevin Chen Date: Thu, 1 Jan 2026 18:27:35 -0500 Subject: [PATCH 1/3] docs: updates release notes based on dependency rearrangement --- .../automatic_directional_navigation.md | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/release-content/release-notes/automatic_directional_navigation.md b/release-content/release-notes/automatic_directional_navigation.md index 250d113177e39..12a2af32283b1 100644 --- a/release-content/release-notes/automatic_directional_navigation.md +++ b/release-content/release-notes/automatic_directional_navigation.md @@ -1,7 +1,7 @@ --- title: Automatic Directional Navigation authors: ["@jbuehler23"] -pull_requests: [21668] +pull_requests: [21668, 22340] --- Bevy now supports **automatic directional navigation graph generation** for UI elements! No more tedious manual wiring of navigation connections for your menus and UI screens. @@ -29,7 +29,9 @@ commands.spawn(( )); ``` -That's it! The `DirectionalNavigationPlugin` includes a system that automatically maintains the navigation graph as your UI changes. +To leverage automatic navigation, use the `AutoDirectionalNavigator` system parameter instead of the `DirectionalNavigation` system parameter. + +That's it! The `DirectionalNavigationPlugin` will set up the resources that `AutoDirectionalNavigator` uses to function. ### Configuration @@ -77,6 +79,15 @@ directional_nav_map.add_edges(&column_entities, CompassOctant::South); // ... repeat for all rows and columns ``` +```rust +// Use the DirectionalNavigation SystemParam to navigate in your system +fn navigation_system(mut directional_navigation: DirectionalNavigation) { + // ... + directional_navigation.navigate(CompassOctant::East); + // ... +} +``` + **After:** ```rust @@ -88,4 +99,13 @@ commands.spawn(( )); ``` +```rust +// Use the AutoDirectionalNavigator SystemParam to navigate +fn navigation_system(mut auto_directional_navigator: AutoDirectionalNavigator) { + // ... + auto_directional_navigator.navigate(CompassOctant::East); + // ... +} +``` + Note: The automatic navigation system requires entities to have position and size information (`ComputedNode` and `UiGlobalTransform` for `bevy_ui` entities). From 32af004c678f7a84b788f66723389e1540a59552 Mon Sep 17 00:00:00 2001 From: Kevin Chen Date: Sat, 3 Jan 2026 18:46:29 -0500 Subject: [PATCH 2/3] style: better conforms to style guide --- .../automatic_directional_navigation.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/release-content/release-notes/automatic_directional_navigation.md b/release-content/release-notes/automatic_directional_navigation.md index 12a2af32283b1..b5fba83dd1b6f 100644 --- a/release-content/release-notes/automatic_directional_navigation.md +++ b/release-content/release-notes/automatic_directional_navigation.md @@ -29,7 +29,15 @@ commands.spawn(( )); ``` -To leverage automatic navigation, use the `AutoDirectionalNavigator` system parameter instead of the `DirectionalNavigation` system parameter. +To leverage automatic navigation, use the `AutoDirectionalNavigator` system parameter instead of the `DirectionalNavigation` system parameter: + +```rust +fn my_navigation_system(mut auto_directional_navigator: AutoDirectionalNavigator) { + // ... + auto_directional_navigator.navigate(CompassOctant::East); + // ... +} +``` That's it! The `DirectionalNavigationPlugin` will set up the resources that `AutoDirectionalNavigator` uses to function. @@ -70,38 +78,30 @@ This is a non-breaking change. Existing manual navigation setups continue to wor If you want to convert existing manual navigation to automatic: -**Before:** - ```rust +// 0.17 // Manually define all edges directional_nav_map.add_looping_edges(&row_entities, CompassOctant::East); directional_nav_map.add_edges(&column_entities, CompassOctant::South); // ... repeat for all rows and columns -``` -```rust // Use the DirectionalNavigation SystemParam to navigate in your system -fn navigation_system(mut directional_navigation: DirectionalNavigation) { +fn my_navigation_system(mut directional_navigation: DirectionalNavigation) { // ... directional_navigation.navigate(CompassOctant::East); // ... } -``` - -**After:** -```rust +// 0.18 // Just add the component to your UI entities commands.spawn(( Button, Node { /* ... */ }, AutoDirectionalNavigation::default(), )); -``` -```rust -// Use the AutoDirectionalNavigator SystemParam to navigate -fn navigation_system(mut auto_directional_navigator: AutoDirectionalNavigator) { +// Use the AutoDirectionalNavigator SystemParam to navigate in your system +fn my_navigation_system(mut auto_directional_navigator: AutoDirectionalNavigator) { // ... auto_directional_navigator.navigate(CompassOctant::East); // ... From f56e9cd5d8467284a12907dee5104af3bafeb677 Mon Sep 17 00:00:00 2001 From: Kevin Chen Date: Mon, 5 Jan 2026 22:32:16 -0500 Subject: [PATCH 3/3] docs: small edits to clarify it does not create a map --- .../release-notes/automatic_directional_navigation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release-content/release-notes/automatic_directional_navigation.md b/release-content/release-notes/automatic_directional_navigation.md index b5fba83dd1b6f..eb4fb154527ec 100644 --- a/release-content/release-notes/automatic_directional_navigation.md +++ b/release-content/release-notes/automatic_directional_navigation.md @@ -4,13 +4,13 @@ authors: ["@jbuehler23"] pull_requests: [21668, 22340] --- -Bevy now supports **automatic directional navigation graph generation** for UI elements! No more tedious manual wiring of navigation connections for your menus and UI screens. +Bevy now supports **automatic directional navigation** for UI elements! No more tedious manual wiring of navigation connections for your menus and UI screens. ## What's New? Previously, creating directional navigation for UI required manually defining every connection between focusable elements using `DirectionalNavigationMap`. For dynamic UIs or complex layouts, this was time-consuming and error-prone. -Now, you can simply add the `AutoDirectionalNavigation` component to your UI entities, and Bevy will automatically compute navigation connections based on spatial positioning. The system intelligently finds the nearest neighbor in each of the 8 compass directions (North, Northeast, East, etc.), considering: +Now, you can simply add the `AutoDirectionalNavigation` component to your UI entities, and Bevy will automatically compute navigation connections based on spatial positioning. The system parameter intelligently finds the nearest neighbor in each of the 8 compass directions (North, Northeast, East, etc.), considering: - **Distance**: Closer elements are preferred - **Alignment**: Elements that are more directly in line with the navigation direction are favored @@ -108,4 +108,4 @@ fn my_navigation_system(mut auto_directional_navigator: AutoDirectionalNavigator } ``` -Note: The automatic navigation system requires entities to have position and size information (`ComputedNode` and `UiGlobalTransform` for `bevy_ui` entities). +Note: Automatic navigation requires entities to have position and size information (`ComputedNode` and `UiGlobalTransform` for `bevy_ui` entities).