Skip to content

Commit f54d79f

Browse files
Migration writing pass 1 (#2053)
Co-authored-by: Alice Cecile <[email protected]>
1 parent 6d4cd58 commit f54d79f

12 files changed

+60
-67
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
- `ErasedAssetLoader` now takes a borrow to `AssetMetaDyn` instead of a `Box`.
2-
- `LoadedAsset::new_with_dependencies` no longer requires a `meta` argument.
3-
- `LoadContext::finish` no longer requires a `meta` argument.
1+
`LoadedAsset` used to have a `meta` field for storing metadata. This field was unused and inaccessible, however, so in 0.16 it has been removed. Due to this change, several method signatures have also changed:
2+
3+
- `ErasedAssetLoader::load()` now takes `meta: &(dyn AssetMetaDyn + 'static)` instead of a `Box<dyn AssetMetaDyn>`.
4+
- `LoadedAsset::new_with_dependencies()` no longer requires a `meta` argument.
5+
- `LoadContext::finish()` no longer requires a `meta` argument.

release-content/0.16/migration-guides/16279_Incorporate_all_node_weights_in_additive_blending.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

release-content/0.16/migration-guides/16401_Headless_by_features.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-
- The `asset_events` system is no longer public. Users should order their systems relative to the `AssetEvents` system set.
1+
The `Assets::asset_events()` system is no longer public. If you wish to order your systems relative to asset events, use the new `AssetEvents` system set instead.
Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
1-
- The `AudioSinkPlayback` trait now has 4 new methods to allow you to mute audio sinks: `is_muted`, `mute`, `unmute` and `toggle_mute`. You can use these methods on `bevy_audio`’s `AudioSink` and `SpatialAudioSink` components to manage the sink’s mute state.
2-
- `AudioSinkPlayback`’s `set_volume` method now takes a mutable reference instead of an immutable one. Update your code which calls `set_volume` on `AudioSink` and `SpatialAudioSink` components to take a mutable reference. E.g.:
1+
It is now possible to mute audio sinks. Several breaking changes have been introduced to implement this feature.
32

4-
Before:
3+
First, `AudioSinkPlayback::set_volume()` now takes a mutable `&mut AudioSinkPlayback` argument instead of an immutable one. This may require you to update your system parameters:
54

65
```rust
7-
fn increase_volume(sink: Single<&AudioSink>) {
6+
// 0.15
7+
fn increase_volume(sink: Single<&AudioSink, With<Music>>) {
88
sink.set_volume(sink.volume() + 0.1);
99
}
10-
```
11-
12-
After:
1310

14-
```rust
15-
fn increase_volume(mut sink: Single<&mut AudioSink>) {
11+
// 0.16
12+
fn increase_volume(mut sink: Single<&mut AudioSink, With<Music>>) {
1613
let current_volume = sink.volume();
1714
sink.set_volume(current_volume + 0.1);
1815
}
1916
```
2017

21-
- The `PlaybackSettings` component now has a `muted` field which you can use to spawn your audio in a muted state. `PlaybackSettings` also now has a helper method `muted` which you can use when building the component. E.g.:
18+
Secondly, `PlaybackSettings` has a new `muted` field to specify whether an entity should start muted. You may need to set this field when creating `PlaybackSettings` if you do not use function update syntax (`..default()`).
2219

23-
```rust
24-
commands.spawn((
25-
// ...
26-
AudioPlayer::new(asset_server.load("sounds/Windless Slopes.ogg")),
27-
PlaybackSettings::LOOP.with_spatial(true).muted(),
28-
));
29-
```
20+
Finally, if you manually implemented audio muting using an audio sink's volume, you can switch over to using the new `AudioSinkPlayback` methods: `is_muted()`, `mute()`, `unmute()` and `toggle_mute()`.
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
- `AudioSinkPlayback`’s `toggle` method has been renamed to `toggle_playback`. This was done to create consistency with the `toggle_mute` method added in https://github.com/bevyengine/bevy/pull/16813. Change instances of `toggle` to `toggle_playback`. E.g.:
2-
3-
Before:
1+
`AudioSinkPlayback::toggle()` has been renamed to `toggle_playback()`. This was done to create consistency with the `toggle_mute()` method added in [#16813]. Please update all references to use the new name.
42

53
```rust
4+
// 0.15
65
fn pause(keyboard_input: Res<ButtonInput<KeyCode>>, sink: Single<&AudioSink>) {
76
if keyboard_input.just_pressed(KeyCode::Space) {
87
sink.toggle();
98
}
109
}
11-
```
12-
13-
After:
1410

15-
```rust
11+
// 0.16
1612
fn pause(keyboard_input: Res<ButtonInput<KeyCode>>, sink: Single<&AudioSink>) {
1713
if keyboard_input.just_pressed(KeyCode::Space) {
1814
sink.toggle_playback();
1915
}
2016
}
2117
```
18+
19+
[#16813]: https://github.com/bevyengine/bevy/pull/16813
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
`bevy_a11y::Focus` has been replaced with `bevy_input_focus::Focus`.
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.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
This release of bevy slightly tweaked the definitions of `EaseFunction::ExponentialIn`, `EaseFunction::ExponentialOut`, and `EaseFunction::ExponentialInOut`. The previous definitions had small discontinuities, while the new ones are slightly rescaled to be continuous. For the output values that changed, that change was less than 0.001, so visually you might not even notice the difference.
1+
`EaseFunction::ExponentialIn`, `EaseFunction::ExponentialOut`, and `EaseFunction::ExponentialInOut` has slight discontinuities in 0.15, leading to [jumping behavior at the start and end of the function][jumping behavior]. In 0.16, these functions have been slightly adjusted so that they are continuous.
22

3-
However, if you depended on them for determinism, you’ll need to define your own curves with the previous definitions.
3+
The new functions differ from the old by less than 0.001, so in most cases this change is not breaking. If, however, you depend on these easing functions for determinism, you will need to define custom curves using the previous functions.
4+
5+
[jumping behavior]: https://github.com/bevyengine/bevy/issues/16676
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
Audio volume can now be configured using decibel values, as well as using linear scale values. To enable this, some types and functions in `bevy_audio` have changed.
2-
3-
- `Volume` is now an enum with `Linear` and `Decibels` variants.
4-
5-
Before:
1+
Audio volume can now be configured using decibel values, as well as using linear scale values. To enable this, some types and functions in `bevy::audio` have changed. First, `Volume` is now an enum with `Linear` and `Decibels` variants:
62

73
```rust
4+
// 0.15
85
let v = Volume(1.0);
9-
```
10-
11-
After:
126

13-
```rust
7+
// 0.16
148
let volume = Volume::Linear(1.0);
15-
let volume = Volume::Decibels(0.0); // or now you can deal with decibels if you prefer
9+
10+
// Alternatively, you can use decibels instead.
11+
let volume = Volume::Decibels(0.0);
1612
```
1713

18-
- `Volume::ZERO` has been renamed to the more semantically correct `Volume::SILENT` because `Volume` now supports decibels and “zero volume” in decibels actually means “normal volume”.
19-
- The `AudioSinkPlayback` trait’s volume-related methods now deal with `Volume` types rather than `f32`s. `AudioSinkPlayback::volume()` now returns a `Volume` rather than an `f32`. `AudioSinkPlayback::set_volume` now receives a `Volume` rather than an `f32`. This affects the `AudioSink` and `SpatialAudioSink` implementations of the trait. The previous `f32` values are equivalent to the volume converted to linear scale so the `Volume:: Linear` variant should be used to migrate between `f32`s and `Volume`.
20-
- The `GlobalVolume::new` function now receives a `Volume` instead of an `f32`.
14+
`Volume::Linear` is equivalent to the old `f32` volume.
15+
16+
With this change, `AudioSinkPlayback`'s volume-related methods (`volume()` and `set_volume()`) and `GlobalVolume` now deal in `Volume`s rather than `f32`s.
17+
18+
Finally, `Volume::ZERO` has been renamed to the more semantically correct `Volume::SILENT`. This is because 0 decibals is equivalent to "normal volume", which could lead to confusion with the old naming.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
Replace `Handle::weak_from_u128` with `weak_handle!` and a random UUID.
1+
`Handle::weak_from_u128()` has been deprecated in favor of the new `weak_handle!` macro, which takes a UUID as a string instead of a `u128`. `weak_handle!` is preferred because it both makes the string form of the UUID visible and it verifies that the UUID is compliant with UUIDv4.
2+
3+
```rust
4+
// 0.15
5+
const SHADER: Handle<Shader> = Handle::weak_from_u128(314685653797097581405914117016993910609);
6+
7+
// 0.16
8+
const SHADER: Handle<Shader> = weak_handle!("1347c9b7-c46a-48e7-b7b8-023a354b7cac");
9+
```

0 commit comments

Comments
 (0)