here is my code, the code after I call app.run() will never reach.
can it be possible to change resource outside bevy system when bevy app is running, what I want to do is changing bevy app resource in the js side when it running in the browser.
fn main() {
let mut app = BevyApp::new();
// never reach
info!("after run info");
app.update_scroll_rate(10.0, 10.0);
}
pub struct BevyApp {
scroll_rate: Arc<Mutex<ScrollRate>>,
}
impl BevyApp {
pub fn new() -> BevyApp{
let arc_resource = Arc::new(Mutex::new(ScrollRate::default()));
App::new()
.insert_resource(Arc::clone(&arc_resource))
.run();
BevyApp {
scroll_rate: arc_resource,
}
}
pub fn update_scroll_rate(&mut self, x: f32, y: f32) {
let mut mgrc = self.scroll_rate.lock().unwrap();
mgrc.x = x;
mgrc.y = y;
}
}