Newbie with a problem #20440
Unanswered
devnullman78
asked this question in
Q&A
Replies: 1 comment 2 replies
-
First off, in markdown, you should put code blocks in triple backticks (```) so that it gets rendered properly. Secondly, the Bevy book's examples are pretty outdated. I highly recommend the docs. The way you add a system is to specify its App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup_camera)
.run(); You can look at the migration guides as well to see what works and what doesn't. Good luck with Bevy! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everybody! I am trying to learn bevy with book called " Game programming in rust" . But every time I am trying to run example code from the book ,it fail to run. Here is the example code from the book and maybe you could tell if there is a syntax error or something else?The book is written at the time when 0.13 version was latest version and that was the version I used as well. I got more problems using 0.16 version with this code. Any ideas,all help is much appreciated.This code snippet is written as it is in the book.
use bevy::prelude::*;
fn main(){
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(setup_camera)
.run()
}
fn setup_camera(mut commands: Commands){
commands.spawn(Camera2dBundle::default());
}
and the error message I got running this code:
error[E0599]: no method named
add_startup_system
found for mutable reference >--> src/main.rs:6:6
|
4 | / App::new()
5 | | .add_plugins(DefaultPlugins)
6 | | .add_startup_system(setup_camera)
| |-^^^^^^^^^^^^^^^^^^
|
help: there is a method
add_systems
with a similar name, but with different a>--> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ap>
|
442 | / pub fn add_systems(
443 | | &mut self,
444 | | schedule: impl ScheduleLabel,
445 | | systems: impl IntoSystemConfigs,
446 | | ) -> &mut Self {
| |_____________^
Beta Was this translation helpful? Give feedback.
All reactions