Skip to content

Commit 6bcf9b4

Browse files
authored
Migration writing pass 2 (#2066)
1 parent afa2f79 commit 6bcf9b4

16 files changed

+190
-48
lines changed

release-content/0.16/migration-guides/16163_Dont_reëxport_bevy_image_from_bevy_render.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1-
The `ui_debug_overlay` module has been removed from `bevy_dev_tools`.
2-
There is a new debug overlay implemented using the `bevy_ui` renderer. To use it, enable the `bevy_ui_debug` feature and set the `enable` field of the `UiDebugOptions` resource to `true`.
1+
The `bevy_dev_tools::ui_debug_overlay` module has been replaced with a new debug overlay implemented using `bevy_ui`'s renderer. The new debug UI overlay still requires the `bevy_ui_debug` feature flag, but this flag is now available through `bevy` and `bevy_ui` instead of `bevy_dev_tools`. `UiDebugOptions` has been moved to `bevy_ui` as well, and now has several new options.
2+
3+
```rust
4+
// 0.15
5+
App::new()
6+
.add_plugins((DefaultPlugins, DebugUiPlugin))
7+
.insert_resource(UiDebugOptions {
8+
enabled: true,
9+
})
10+
.run();
11+
12+
// 0.16
13+
App::new()
14+
// You no longer need `DebugUiPlugin`; enabling the `bevy_ui_debug` feature handles this for
15+
// you.
16+
.add_plugins(DefaultPlugins)
17+
.insert_resource(UiDebugOptions {
18+
enabled: true,
19+
// `UiDebugOptions` has a few new options, but for now we'll leave the defaults.
20+
..default()
21+
})
22+
.run();
23+
```
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
The `CachedSystemId` resource has been changed:
1+
As part of a bug fix for system caching, the `CachedSystemId` resource has been changed to store an `Entity` instead of a `SystemId`. `CachedSystemId` construction has also been changed to use the `new()` method.
22

33
```rust
4-
// Before:
5-
let cached_id = CachedSystemId::<S::System>(id);
4+
// 0.15
5+
let cached_id = CachedSystemId::<S::System>::(id);
66
assert!(id == cached_id.0);
77

8-
// After:
8+
// 0.16
99
let cached_id = CachedSystemId::<S>::new(id);
10+
// You can convert a valid `Entity` into a `Systemid` with `SystemId::from_entity()`.
1011
assert!(id == SystemId::from_entity(cached_id.entity));
1112
```
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
- `BrpQueryParams` now has `strict` boolean field. It serfs as a flag to fail when encountering an invalid component rather than skipping it. Defaults to false.
1+
Bevy Remote Protocol's `bevy/query` request now skips missing or invalid components by default instead of returning an error. This can be configured with `BrpQueryParams`'s new `strict` boolean field.
2+
3+
If you wish `bevy/query` to return to its previous behavior of erroring on missing / invalid components, set `"strict": true`:
4+
5+
```json
6+
{
7+
"method": "bevy/query",
8+
"id": 0,
9+
"params": {
10+
"data": {
11+
"components": ["foo::bar::MyComponent"]
12+
},
13+
// Error if `foo::bar::MyComponent` doesn't exist.
14+
"strict": true
15+
}
16+
}
17+
```

release-content/0.16/migration-guides/16778_Event_source_location_tracking.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Bevy now has first-class input handling, available in the `bevy::input_focus` module. As such, `bevy::a11y::Focus` has been replaced with `bevy::input_focus::Focus`. Please replace all references and imports.
1+
Bevy now has first-class input handling, available in the `bevy::input_focus` module. As such, `bevy::a11y::Focus` has been replaced with `bevy::input_focus::InputFocus`. Please replace all references and imports.
Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1-
- `IntoSystemConfigs` has been removed for `BoxedSystem<(), ()>`. Either use `InfallibleSystemWrapper` before boxing or make your system return `bevy::ecs::prelude::Result`.
1+
`bevy::ecs::IntoSystemConfigs`, now known as `IntoScheduleConfigs`, is no longer implemented for `BoxedSystem<(), ()>`. This can lead to convoluted trait errors when you try to add a `BoxedSystem<(), ()>` to a schedule or app:
2+
3+
```
4+
error[E0277]: `std::boxed::Box<dyn bevy::prelude::System<In = (), Out = ()>>` does not describe a valid system configuration
5+
```
6+
7+
In order to avoid this error, either wrap your system in an `InfallibleSystemWrapper` before boxing it or make the system return a `Result<(), BevyError>`.
8+
9+
```rust
10+
// 0.15
11+
fn my_system() {
12+
println!("Hello, world!");
13+
}
14+
15+
// Convert the function into a boxed system, which is a `Box<dyn System<In = (), Out = ()>>`.
16+
let system = Box::new(IntoSystem::into_system(my_system)) as BoxedSystem;
17+
18+
App::new()
19+
.add_systems(Startup, system)
20+
.run();
21+
22+
// 0.16 (Using `InfallibleSystemWrapper`)
23+
fn my_system() {
24+
println!("Hello, world!");
25+
}
26+
27+
// Use `InfallibleSystemWrapper::new()` to make a system unconditionally return `Result::Ok`. The
28+
// boxed system is now a `Box<dyn System<In = (), Out = Result<(), BevyError>>>`.
29+
let system = Box::new(InfallibleSystemWrapper::new(IntoSystem::into_system(my_system))) as BoxedSystem<_, _>;
30+
31+
App::new()
32+
.add_systems(Startup, system)
33+
.run();
34+
35+
// 0.16 (Returning `Result<(), BevyError>`)
36+
fn my_system() -> Result {
37+
println!("Hello, world!");
38+
Ok(())
39+
}
40+
41+
// The boxed system is now a `Box<dyn System<In = (), Out = Result<(), BevyError>>>`.
42+
let system = Box::new(IntoSystem::into_system(my_system)) as BoxedSystem<_, _>;
43+
44+
App::new()
45+
// Add the boxed system to the app.
46+
.add_systems(Startup, system)
47+
.run();
48+
```
49+
50+
Note that in several cases you do not need to box your systems before adding them, such as with `App::add_systems()`, which lets you avoid this issue.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
The `track_change_detection` feature flag has been renamed to `track_location` to better reflect its extended capabilities.
1+
The `track_change_detection` feature flag no longer just tracks the source code location for change detection, but also where entities are spawned and despawned. As such, the feature flag has been renamed to `track_location` to better reflect its extended capabilities.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
`FrameTimeDiagnosticsPlugin` now contains two fields. Use `FrameTimeDiagnosticsPlugin::default()` to match Bevy’s previous behavior or, for example, `FrameTimeDiagnosticsPlugin::new(60)` to configure it.
1+
`FrameTimeDiagnosticsPlugin` now contains two fields: `max_history_length` and `smoothing_factor`. If you manually construct this plugin and wish to retain 0.15 behavior, simply call `FrameTimeDiagnosticsPlugin::default()`. If you wish to configure the maximum history length, you may use `FrameTimeDiagnosticsPlugin::new()` instead.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
- `World::try_despawn` now returns a `Result` rather than a `bool`.
2-
- `World::try_insert_batch` and `World::try_insert_batch_if_new` now return a `Result` where they previously returned nothing.
1+
`World::try_despawn()` now returns a `Result` rather than a `bool`. Additionally, `World::try_insert_batch()` and `World::try_insert_batch_if_new()` now return a `Result` instead of silently failing.

0 commit comments

Comments
 (0)