You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Systems using the old `commands: &mut Commands` syntax in 0.5 will fail to compile when calling `foo.system()`.
26
26
27
-
This change was made because {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.5.0" name="Commands" no_mod=true)}}
28
-
now holds an internal {{rust_type(type="struct" crate="bevy_ecs" mod="world" version="0.5.0" name="World" no_mod=true)}}
27
+
This change was made because [`Commands`] now holds an internal [`World`]
29
28
reference to enable safe entity allocations.
30
29
31
-
Note: The internal {{rust_type(type="struct" crate="bevy_ecs" mod="world" version="0.5.0" name="World" no_mod=true)}} reference requires two lifetime parameters to pass Commands into a non-system function: `commands: &'a mut Commands<'b>`
30
+
Note: The internal [`World`] reference requires two lifetime parameters to pass Commands into a non-system function: `commands: &'a mut Commands<'b>`
The {{rust_type(type="struct" crate="bevy_ecs" version="0.5.0" mod="system" name="Commands" no_mod=true)}} API has been completely reworked for consistency with the {{rust_type(type="struct" crate="bevy_ecs" mod="world" version="0.5.0" name="World" no_mod=true)}} API.
37
+
The [`Commands`]API has been completely reworked for consistency with the [`World`] API.
36
38
37
39
```rust
38
40
// 0.4
@@ -97,12 +99,15 @@ if timer.tick(time.delta()).finished() { /* do stuff */ }
97
99
timer.elapsed() // returns a `Duration`
98
100
```
99
101
100
-
Most of the methods of {{rust_type(type="struct" crate="bevy_core" version="0.5.0" name="Timer" no_mod=true)}}
101
-
now use `Duration` instead of `f32`.
102
+
Most of the methods of [`Timer`]
103
+
now use [`Duration`] instead of `f32`.
102
104
103
105
This change allows timers to have consistent, high precision. For convenience, there is also an
104
106
`elapsed_secs` method that returns `f32`. Otherwise, when you need an `f32`, use the
105
-
`as_secs_f32()` method on `Duration` to make the conversion.
107
+
`as_secs_f32()` method on [`Duration`] to make the conversion.
Copy file name to clipboardExpand all lines: content/learn/book/migration-guides/0.5-0.6/_index.md
+61-24Lines changed: 61 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,9 @@ members = [ "my_crate1", "my_crate2" ]
29
29
30
30
### "AppBuilder" was merged into "App"
31
31
32
-
All functions of {{rust_type(type="struct" crate="bevy_app" mod="" version="0.5.0" name="AppBuilder" no_mod=true)}} were merged into {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true)}}.
32
+
All functions of [`AppBuilder`]were merged into [`App`].
33
33
34
-
In practice this means that you start constructing an {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true)}} by calling {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true method="new")}} instead of {{rust_type(type="struct" crate="bevy_app" mod="" version="0.5.0" name="App" no_mod=true method="build")}} and {{rust_type(type="trait" crate="bevy_app" mod="" version="0.5.0" name="Plugin" no_mod=true method="build")}} takes a {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true)}} instead of a {{rust_type(type="struct" crate="bevy_app" mod="" version="0.5.0" name="AppBuilder" no_mod=true)}}
34
+
In practice this means that you start constructing an [`App`]by calling [`App::new`] instead of [`App::build`] and [`Plugin::build`] takes a [`App`]instead of a [`AppBuilder`].
Bevy no longer has a blanket implementation for the {{rust_type(type="trait" crate="bevy_ecs" mod="component" version="0.6.0" name="Component" no_mod=true)}} trait.
72
+
Bevy no longer has a blanket implementation for the [`Component`] trait.
67
73
Instead you need to derive (or manualy implement) the trait for every Type that needs it.
68
74
69
75
```rust
@@ -82,9 +88,11 @@ In order to use foreign types as components, wrap them using the newtype pattern
### Setting the Component Storage is now done in "Component" Trait
86
94
87
-
The change to deriving {{rust_type(type="trait" crate="bevy_ecs" mod="component" version="0.6.0" name="Component" no_mod=true)}}, enabled setting the Component Storage at compiletime instead of runtime.
95
+
The change to deriving [`Component`], enabled setting the Component Storage at compiletime instead of runtime.
88
96
89
97
```rust
90
98
// 0.5
@@ -145,9 +153,9 @@ fn main() {
145
153
146
154
### ".single()" and ".single_mut()" are now infallible
147
155
148
-
The functions {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="single")}} and {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="single_mut")}} no longer return a {{rust_type(type="enum", crate="std" mod="result", name="Result", no_mod=true)}} and Panic instead, if not exactly one Entity was found.
156
+
The functions [`Query::single()`] and [`Query::single_mut()`] no longer return a `Result`and instead panic unless exactly one entity was found.
149
157
150
-
If you need the old behavior you can use the fallible {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="get_single")}} and {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="get_single_mut")}} instead.
158
+
If you need the old behavior you can use the fallible [`Query::get_single()`] and [`Query_get_single_mut()`] instead.
The {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.5.0" name="Light" no_mod=true)}} and {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.5.0" name="LightBundle" no_mod=true)}} were renamed to {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="PointLight" no_mod=true)}} and {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="PointLightBundle" no_mod=true)}} to more clearly communicate the behavior of the Light Source.
198
-
At the same time the `fov` and `depth` fields were removed from the {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="PointLight" no_mod=true)}} as they were unused.
199
-
200
-
<!-- TODO: Remove this comment if https://github.com/bevyengine/bevy/pull/2367 is merged.
210
+
The [`Light`] and [`LightBundle`] types were renamed to [`PointLight`] and [`PointLightBundle`] to more clearly communicate the behavior of the Light Source.
211
+
At the same time the `fov` and `depth` fields were removed from [`PointLight`] as they were unused.
201
212
202
-
In addition the {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="DirectionalLight" no_mod=true)}} and {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="DirectionalLightBundle" no_mod=true)}} were introduced with `0.6`.
The Lifetime of {{rust_type(type="trait" crate="bevy_ecs" mod="system" version="0.5.0" name="SystemParam" no_mod=true)}} was split in two separate Lifetimes.
220
+
The Lifetime of [`SystemParam`] was split in two separate Lifetimes.
<!-- Adapt for ParamSet instead, if https://github.com/bevyengine/bevy/pull/2765 is merged -->
246
+
### QuerySet declare "QueryState" instead of "Query"
235
247
236
-
Due to the [System Param Lifetime Split](#system-param-lifetime-split), {{rust_type(type="struct" crate="bevy_ecs" mod="system" name="QuerySet" version="0.6.0" no_mod=true plural=true)}} now need to specify their Queries with {{rust_type(type="struct" crate="bevy_ecs" mod="query" version="0.6.0" name="QueryState" no_mod=true)}} instead of {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true)}}.
248
+
Due to the [System Param Lifetime Split](#system-param-lifetime-split), [`QuerySet`]system parameters now need to specify their Queries with [`QuerySet`]instead of [`Query`].
### "Input\<T\>.update()" is renamed to "Input\<T\>.clear()"
251
267
252
-
The {{rust_type(type="struct" crate="bevy_input" mod="" version="0.5.0" name="Input" no_mod=true method="update")}} function was renamed to {{rust_type(type="struct" crate="bevy_input" mod="" version="0.6.0" name="Input" no_mod=true method="clear")}}.
268
+
The [`Input::update`] function was renamed to [`Input::clear`].
The {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.5.0" name="SystemState" no_mod=true)}} struct, which stores the metadata of a System, was renamed to {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="SystemMeta" no_mod=true)}}.
275
+
The struct formerly known as [`SystemState`](https://docs.rs/bevy/0.5.0/bevy/ecs/system/struct.SystemState.html), which stores the metadata of a System, was renamed to [`SystemMeta`].
257
276
258
-
This was done to accommodate the new {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="SystemState" no_mod=true)}} which allows easier cached access to {{rust_type(type="trait" crate="bevy_ecs" mod="system" version="0.6.0" name="SystemParam" no_mod=true plural=true)}} outside of a regular System.
277
+
This was done to accommodate the new [`SystemState`] which allows easier cached access to [`SystemParam`] outside of a regular System.
<!-- TODO: Link to entry for SystemState in the release blog post. -->
261
283
262
284
### Vector casting functions are now named to match return type
263
285
264
-
The casting functions for {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="IVec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="DVec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="UVec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec2" no_mod=true)}} have all been changed from being named after their inner elements' cast target to what the entire "Vec" is being casted into. This affects all the different dimensions of the math vectors (i.e., {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec3" no_mod=true)}} and {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec4" no_mod=true)}}).
286
+
The casting functions for [`IVec2`], [`DVec2`], [`UVec2`], and [`Vec2`]have all been changed from being named after their inner elements' cast target to what the entire "Vec" is being casted into. This affects all the different dimensions of the math vectors (i.e., [`Vec2`], [`Vec3`]and [`Vec4`]).
### StandardMaterial's "roughness" is renamed to "perceptual_roughness"
277
306
278
-
The {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="StandardMaterial" no_mod=true)}} field `roughness` was renamed to `perceptual_roughness`.
307
+
The [`StandardMaterial`] field `roughness` was renamed to `perceptual_roughness`.
The {{rust_type(type="struct" crate="bevy_sprite" mod="" version="0.6.0" name="SpriteBundle" no_mod=true)}} now uses a `texture` handle rather than a `material`. The `color` field of the material is now directly available inside of the {{rust_type(type="struct" crate="bevy_sprite" mod="" version="0.6.0" name="Sprite" no_mod=true)}} struct, which also had its `resize_mode` field replaced with a `custom_size`. The following example shows how to spawn a tinted sprite at a particular size. For simpler cases, check out the updated [sprite](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/sprite.rs) and [rect](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/rect.rs) examples.
313
+
The [`SpriteBundle`] bundle type now uses a `texture` handle rather than a `material`. The `color` field of the material is now directly available inside of the [`Sprite`] struct, which also had its `resize_mode` field replaced with a `custom_size`. The following example shows how to spawn a tinted sprite at a particular size. For simpler cases, check out the updated [sprite](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/sprite.rs) and [rect](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/rect.rs) examples.
The {{rust_type(type="struct" crate="bevy" mod="render::draw" version="0.5.0" name="Visible" no_mod=true)}} struct, which is used in a number of components to set visibility, was renamed to {{rust_type(type="struct" crate="bevy" mod="render::view" version="0.6.0" name="Visibility" no_mod=true)}}. Additionally, the field `is_transparent` was removed from the struct. For 3D, transparency can be set using the `alpha_mode` field on a material. Transparency is now automatically enabled for all objects in 2D.
346
+
The [`Visible`]struct, which is used in a number of components to set visibility, was renamed to [`Visibility`]. Additionally, the field `is_transparent` was removed from the struct. For 3D, transparency can be set using the `alpha_mode` field on a material. Transparency is now automatically enabled for all objects in 2D.
Copy file name to clipboardExpand all lines: content/learn/book/welcome/apps/_index.md
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,12 @@ template = "book-section.html"
5
5
page_template = "book-section.html"
6
6
+++
7
7
8
-
Bevy programs store and execute all of their game logic and data with a single {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}} data structure.
8
+
Bevy programs store and execute all of their game logic and data with a single [`App`] data structure.
9
9
10
10
Let's make a trivial Hello World app to demonstrate how that works in practice.
11
-
The process is straightforward: we first create a new {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}}.
11
+
The process is straightforward: we first create a new [`App`].
12
12
Then, we add a simple system, which prints "Hello, Bevy!" when it is run.
13
-
Finally once we're done configuring the app, we call {{rust_type(type="struct" crate="bevy" mod = "app" name="App" method="run" no_mod = "true")}} to actually make our app *do things*.
13
+
Finally once we're done configuring the app, we call [`App`] to actually make our app *do things*.
14
14
15
15
```rust
16
16
usebevy::prelude::*;
@@ -28,18 +28,18 @@ fn hello(){
28
28
29
29
## What makes an App?
30
30
31
-
So, what sort of data does our {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}} really store?
31
+
So, what sort of data does our [`App`] really store?
32
32
Looking at the docs linked, we find three fields: `world`, `schedule` and `runner`.
33
33
The `world` field stores all of our game's data, the `schedule` holds the systems that operate on this data (and the order in which they do so) and the `runner` interprets the schedule to control the broad execution strategy.
34
34
You can read more about these by exploring the reference documentation linked just above.
35
35
36
36
Generally, you'll be operating at a more granular level than these basic primitives: controlling data in terms of specific resources or components and adding systems to an existing schedule.
37
-
To do so, customize your own {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}} by chaining its methods with the [builder pattern](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html).
37
+
To do so, customize your own [`App`] by chaining its methods with the [builder pattern](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html).
38
38
The most basic tools are:
39
39
40
-
1. Initializing resources in the {{rust_type(type="struct" crate="bevy" mod = "ecs/world" name="World" no_mod = "true")}} to store globally available data that we only need a single copy of.
41
-
2. Adding systems to our {{rust_type(type="struct" crate="bevy" mod = "ecs/schedule" name="Schedule" no_mod = "true")}}, which can read and modify resources and our entities' components, according to our game logic.
42
-
3. Importing other blocks of {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}}-modifying code using plugins.
40
+
1. Initializing resources in the [`World`] to store globally available data that we only need a single copy of.
41
+
2. Adding systems to our [`Schedule`], which can read and modify resources and our entities' components, according to our game logic.
42
+
3. Importing other blocks of [`App`]-modifying code using [`Plugins`].
43
43
Let's write a very simple demo that shows how those work.
0 commit comments