Skip to content

[Merged by Bors] - 0.7 migration guide #332

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

Closed
wants to merge 22 commits into from
Closed
Changes from 6 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
157 changes: 157 additions & 0 deletions content/learn/book/migration-guides/0.6-0.7/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
+++
title = "0.6 to 0.7"
weight = 1
sort_by = "weight"
template = "book-section.html"
page_template = "book-section.html"
insert_anchor_links = "right"
[extra]
long_title = "Migration Guide: 0.6 to 0.7"
+++

<!-- Github filter used to find the relevant PRs "is:pr label:C-Breaking-Change closed:>2022-02-01 [Merged by Bors]" -->

### AliasedMutability

<https://github.com/bevyengine/bevy/pull/4298>

The QueryEntityError enum now has a `AliasedMutability` variant, and returns the offending entity

### Remove margins.rs

<https://github.com/bevyengine/bevy/pull/4284>

The Margins type got removed. To migrate you just have to change every occurrence of Margins to UiRect.

### Remove face_toward.rs

<https://github.com/bevyengine/bevy/pull/4277>

The FaceToward trait got removed. To migrate you just have to change every occurrence of Mat4::face_toward to Mat4::look_at_rh.

### unsafeify World::entities_mut

<https://github.com/bevyengine/bevy/pull/4093>

```rs
// 0.6
world.entities_mut()

// 0.7
unsafe { world.entities_mut() }
```

### Mesh vertex buffer layouts

<https://github.com/bevyengine/bevy/pull/3959>

TODO

### Remove the need for 'IntoSystem::into_system()' when using run criteria piping

<https://github.com/bevyengine/bevy/pull/3923>

```rs
// 0.6
.with_run_criteria(RunCriteria::pipe(
"is_done_label",
IntoSystem::into_system(inverse),
))

// 0.7
.with_run_criteria(RunCriteria::pipe("is_done_label", inverse))
```

### Obviate the need for RunSystem, and remove it

<https://github.com/bevyengine/bevy/pull/3817>

TODO

### Replace VSync with PresentMode

https://github.com/bevyengine/bevy/pull/3812

Instead of using a boolean flag for vsync we switched to using a {{rust_type(type="struct" crate="bevy" mod="window" version="0.7.0" name="PresentMode" no_mod=true)}} enum with multiple variants.

```rs
// 0.6
App::new()
.insert_resource(WindowDescriptor {
vsync: false,
..Default::default()
})

// 0.7
App::new()
.insert_resource(WindowDescriptor {
present_mode: PresentMode::Mailbox,
..Default::default()
})
```

### Fix mul_vec3 tranformation order

<https://github.com/bevyengine/bevy/pull/3811>

Fixes order of transformations to scale -> rotate -> translate. This doesn't require any code changes, but it means SpriteBundle will behave as expected when rotating.

### Use marker components for cameras instead of name strings

<https://github.com/bevyengine/bevy/pull/3635>

TODO

### Remove the config api

<https://github.com/bevyengine/bevy/pull/3633>

TODO

### Add capability to render to a texture

<https://github.com/bevyengine/bevy/pull/3412>

```rs
// 0.6
commands.spawn_bundle(PerspectiveCameraBundle {
camera: Camera {
window: window_id,
..Default::default()
},
..Default::default()
});

// 0.7
commands.spawn_bundle(PerspectiveCameraBundle {
camera: Camera {
target: RenderTarget::Window(window_id),
..Default::default()
},
..Default::default()
});
```

### Implement init_resource for Commands and World

<https://github.com/bevyengine/bevy/pull/3079>

```rs
#[derive(Default)]
struct Scoreboard {
current_score: u32,
high_score: u32,
}

// 0.6
commands.insert_resource(Scoreboard::Default());

// 0.7
commands.init_resource::<Scoreboard>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't the 0.6 and the 0.7 examples here have different behaviour in case there is already a scoreboard resource?

Maybe we should just say this is new functionality on Commands, so no 0.6 example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's a migration guide, if it's purely new then it doesn't need any migration. I just did that after a quick glance at the PR. I wasn't sure what the change was.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.
It is possible to get the same functionality in 0.6 with an exclusive system. We could compare that with a 0.7 system that only needs commands.

```

### ParamSet for conflicting SystemParam

<https://github.com/bevyengine/bevy/pull/2765>

TODO