From 057ad97a46136b77082d0867dcebc324dbd1b6f9 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Fri, 24 Apr 2020 18:23:37 -0700 Subject: [PATCH] fix dynamic plugin example --- Cargo.toml | 1 + crates/bevy_derive/src/lib.rs | 2 +- examples/dynamic_plugin_loading/example_plugin/src/lib.rs | 7 +++---- examples/dynamic_plugin_loading/main.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 16346bb83b..38012d889d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ glam = "0.8.6" [workspace] members = [ "crates/*", + "examples/dynamic_plugin_loading/example_plugin" ] [dev-dependencies] diff --git a/crates/bevy_derive/src/lib.rs b/crates/bevy_derive/src/lib.rs index 693142d9fc..a44e4870cf 100644 --- a/crates/bevy_derive/src/lib.rs +++ b/crates/bevy_derive/src/lib.rs @@ -476,7 +476,7 @@ pub fn derive_app_plugin(input: TokenStream) -> TokenStream { TokenStream::from(quote! { #[no_mangle] - pub extern "C" fn _create_plugin() -> *mut bevy::app::plugin::AppPlugin { + pub extern "C" fn _create_plugin() -> *mut bevy::app::AppPlugin { // TODO: without this the assembly does nothing. why is that the case? print!(""); // make sure the constructor is the correct type. diff --git a/examples/dynamic_plugin_loading/example_plugin/src/lib.rs b/examples/dynamic_plugin_loading/example_plugin/src/lib.rs index 4b289f191d..c7a969215f 100644 --- a/examples/dynamic_plugin_loading/example_plugin/src/lib.rs +++ b/examples/dynamic_plugin_loading/example_plugin/src/lib.rs @@ -4,8 +4,8 @@ use bevy::prelude::*; pub struct ExamplePlugin; impl AppPlugin for ExamplePlugin { - fn build(&self, app_builder: AppBuilder) -> AppBuilder { - app_builder.setup(setup) + fn build(&self, app_builder: &mut AppBuilder) { + app_builder.add_startup_system(setup); } } @@ -40,6 +40,5 @@ pub fn setup(world: &mut World, resources: &mut Resources) { Vec3::new(0.0, 0.0, 1.0), )), ..Default::default() - }) - .build(); + }); } \ No newline at end of file diff --git a/examples/dynamic_plugin_loading/main.rs b/examples/dynamic_plugin_loading/main.rs index 282ad3a4b9..ae1a8f2a4d 100644 --- a/examples/dynamic_plugin_loading/main.rs +++ b/examples/dynamic_plugin_loading/main.rs @@ -5,7 +5,7 @@ fn main() { .add_default_plugins() .load_plugin(concat!( env!("CARGO_MANIFEST_DIR"), - "/examples/dynamic_plugin_loading/example_plugin/target/release/libexample_plugin.so" + "/target/debug/libexample_plugin.so" )) .run(); }