Bevy version and features
bevy 0.19.0 with default features
What you did
tried to reproduce the dynamic expression behavior from the scene notation docs
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
#[derive(Component, FromTemplate)]
pub struct Health {
pub current: u32,
pub max: u32,
}
#[derive(Component, FromTemplate)]
pub struct Sprite {
pub image: Handle<Image>,
}
fn enemy(hp: u32, name: &str) -> impl Scene {
let name_string = name.to_string();
bsn! {
#{name}
Health { current: {hp / 2}, max: hp }
Sprite { image: {name_string + ".png"} }
}
}
fn setup(mut commands: Commands) {
commands.spawn_scene(bsn! { enemy(200, "goblin") });
}
What went wrong
error: expected identifier
--> src/main.rs:24:10
|
24 | #{name}
| ^
error: could not compile `dynamic_expr_repro` (bin "dynamic_expr_repro") due to 1 previous error
i'm not sure if this is meant to be a currently supported feature or if it's not yet fully implemented and scheduled for a full release, but it may be helpful if the docs reflected that if so
Bevy version and features
bevy 0.19.0 with default features
What you did
tried to reproduce the dynamic expression behavior from the scene notation docs
What went wrong
i'm not sure if this is meant to be a currently supported feature or if it's not yet fully implemented and scheduled for a full release, but it may be helpful if the docs reflected that if so