Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing details for UI in Migration Guide 0.10 -> 0.11 #700

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion content/learn/migration-guides/0.10-0.11/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,23 @@ Replace `OnUpdate` with `run_if(in_state(xxx))`.

`QueryEntityError::QueryDoesNotMatch`'s display message changed from "The given entity does not have the requested component." to "The given entity's components do not match the query.".

### [Update syn, encase, glam and hexasphere](https://github.com/bevyengine/bevy/pull/8573)

<div class="migration-guide-area-tags">
<div class="migration-guide-area-tag">ECS</div>
</div>

Using `#[bundle]` attribute when deriving `Bundle` for nested bundles now throws an error. It was already not required since version 0.9, see [the migration guide](https://bevyengine.org/learn/migration-guides/0.8-0.9/#implement-bundle-for-component-use-bundle-tuples-for-insertion).

```rust
#[derive(Bundle)]
struct PlayerBundle {
#[bundle] // Remove this line
sprite_bundle: SpriteBundle,
collider: Collider,
}
```

### [Rename keys like `LAlt` to `AltLeft`](https://github.com/bevyengine/bevy/pull/8792)

<div class="migration-guide-area-tags">
Expand Down Expand Up @@ -1315,7 +1332,19 @@ The event `TouchPhase::Cancelled` is now called `TouchPhase::Canceled`
<div class="migration-guide-area-tag">UI</div>
</div>

The `UiSystem::Flex` system set has been renamed to `UiSystem::Layout`
- The `UiSystem::Flex` system set has been renamed to `UiSystem::Layout`.
- It is not possible to use the struct literal update syntax in const time with `Style` anymore, since one of its field implements `Drop`, doing so would raise a "the destructor for this type cannot be evaluated in constants" error. Implement all the fields or don't use `Style` in a `const` variable. See [this issue](https://github.com/bevyengine/bevy/issues/9095).

```rust
// 0.10
pub const ABSOLUTE_STYLE: Style = Style {
position_type: PositionType::Absolute,
..Style::DEFAULT
};

// 0.11
// Implement all the fields or don't use const
```

### [`MeasureFunc` improvements](https://github.com/bevyengine/bevy/pull/8402)

Expand All @@ -1327,6 +1356,34 @@ The `UiSystem::Flex` system set has been renamed to `UiSystem::Layout`
- The `upsert_leaf` function has been removed from `UiSurface` and replaced with `update_measure` which updates the `MeasureFunc` without node insertion.
- The `dyn_clone` method has been removed from the `Measure` trait.
- The new function of `CalculatedSize` has been replaced with the method `set`.
- `ImageBundle` and `TextBundle` don't implement `Clone` anymore. [You can either](https://github.com/bevyengine/bevy-website/issues/699):

1. Wrap yourself the bundle type and implement `Clone` by skipping cloning the `ContentSize` field.
2. Use a closure instead of `clone`:

```rust
// 0.10
let circle = ImageBundle {
style: image_style,
image: materials.circle.clone(),
..Default::default()
};
commands.spawn(circle.clone());
commands.spawn(circle.clone());
commands.spawn(circle.clone());
commands.spawn(circle.clone());

// 0.11
let circle = || ImageBundle {
style: image_style,
image: materials.circle.clone(),
..Default::default()
};
commands.spawn(circle());
commands.spawn(circle());
commands.spawn(circle());
commands.spawn(circle());
```

### [Divide by `UiScale` when converting UI coordinates from physical to logical](https://github.com/bevyengine/bevy/pull/8720)

Expand Down
4 changes: 2 additions & 2 deletions content/news/2023-07-09-bevy-0.11/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ At first glance, this might not seem very useful. But in combination with per-tu

```rust
app.add_systems(Update, (
(attack, defend).in_set(Combat).before(check_health)
(attack, defend).in_set(Combat).before(check_health),
check_health,
(handle_death, respawn).after(check_health)
))
Expand All @@ -551,7 +551,7 @@ app.add_systems(Update, (
```rust
app.add_systems(Update,
(
(attack, defend).in_set(Combat)
(attack, defend).in_set(Combat),
check_health,
(handle_death, respawn)
).chain()
Expand Down