Profile Picture

Assorted tech

Hi, my name is Spencer. I'm a CS graduate focused on systems programming, Linux, and low-complexity design. Other interests: metal, hiking, guitar, rationality.

feed | contact

Bevy 0.3 → 0.4 Update Guide

Calendar icon December 19, 2020

Clock icon 3 min read

Folder icon #bevy #gamedev #rust #engine #update in tech

Bevy 0.4

Version 0.4 of the Bevy game engine just came out this morning. Here are some of the changes (likely not all) that you either should or need to make if you want to switch to the new version Before that, I’d like to thank the other 65 contributors and Bevy’s helpful community for helping to make something so cool.

Components → Bundles

The following have been renamed:

Commands syntax change

If you see a cryptic error such as this:

error[E0599]: no method named `system` found for fn item `for<'r, 's> fn(bevy::prelude::Commands, bevy::prelude::ResMut<'r, bevy::prelude::Assets<bevy::prelude::Mesh>>, bevy::prelude::ResMut<'s, bevy::prelude::Assets<bevy::prelude::StandardMaterial>>) {world::setup_world}` in the current scope
  --> src/main.rs:15:41
   |
15 |         .add_startup_system(setup_world.system())
   |                                         ^^^^^^ method not found in `for<'r, 's> fn(bevy::prelude::Commands, bevy::prelude::ResMut<'r, bevy::prelude::Assets<bevy::prelude::Mesh>>, bevy::prelude::ResMut<'s, bevy::prelude::Assets<bevy::prelude::StandardMaterial>>) {world::setup_world}`
   |
   = note: `setup_world` is a function, perhaps you wish to call it

It is probably because

mut commmands: Commands

should now be

commands: &mut commands

Vector, Matrix, and Quaternion changes

Components are now fields

If you were trying to access a specific component of one of these objects, perhaps the x-component with

Vec3::unit_x().x()

You simply need to remove the parenthesis because .x() is no longer a method:

Vec3::unit_x().x

The same goes for axes: x_axis() becomes x_axis

Changelog

Element accessors deprecated

.x_mut() and .set_x() are now accessed with x().

Changelog

Removed .all()

my_vec.is_nan()

Now suffices in the place of

my_vec.is_nan().all()

Changelog

Reflection

Property has been removed in favor of Reflect, if you see the error error: cannot find derive macro Property in this scope, then replace

#[derive(Property)]
struct Example;

with

#[derive(Reflect)]
struct Example;

The Bevy repo has reflection examples that can be compared against the usage of Property in the 0.3 scene example.

Relevant release notes

Portability

As the release post states:

… some platforms (currently Android and iOS) require additional boilerplate … Bevy 0.4 adds a new #[bevy_main] proc-macro, which inserts the relevant boilerplate for you.

So if you want Android/iOS support, just add the macro atop of your main function:

#[bevy_main]
fn main() {
    App::build().run();
}

Additional issues

If you’d like something added to this post to help others, just contact me (perhaps by email).

Comments