-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I can't access any resources inserted directly via app.insert_resource when paired with the app.with_hot_path(|app| { ... }) function.
Recreation:
use bevy::prelude::*;
use bevy_simple_subsecond_system::prelude::*;
fn main() -> AppExit {
App::new()
.add_plugins((DefaultPlugins, SimpleSubsecondPlugin::default()))
.with_hot_patch(|app| {
app.insert_resource(Test { value: 42 });
app.add_systems(Update, test);
})
.run()
}
#[derive(Resource)]
struct Test {
value: usize,
}
fn test(test_res: Res<Test>) {
println!("Test value: {}", test_res.value);
}Crash Log
11:39:16 [macos] Encountered an error in system `bug::test`: Parameter `Res<Test>` failed validation: Resource does not exist
11:39:16 [macos] 4: <T as core::convert::Into<U>>::into
11:39:16 [macos] at /Users/connormeehan/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/convert/mod.rs:767:9
11:39:16 [macos] 5: bevy_ecs::schedule::executor::multi_threaded::ExecutorState::should_run
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/executor/multi_threaded.rs:591:31
11:39:16 [macos] 6: bevy_ecs::schedule::executor::multi_threaded::ExecutorState::spawn_system_tasks
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/executor/multi_threaded.rs:427:27
11:39:16 [macos] 7: bevy_ecs::schedule::executor::multi_threaded::ExecutorState::tick
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/executor/multi_threaded.rs:377:18
11:39:16 [macos] 8: bevy_ecs::schedule::executor::multi_threaded::Context::tick_executor
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/executor/multi_threaded.rs:317:19
11:39:16 [macos] 9: <bevy_ecs::schedule::executor::multi_threaded::MultiThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run::{{closure}}
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/executor/multi_threaded.rs:233:25
11:39:16 [macos] 10: bevy_tasks::task_pool::TaskPool::scope_with_executor_inner
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0/src/task_pool.rs:408:9
11:39:16 [macos] 11: bevy_tasks::task_pool::TaskPool::scope_with_executor::{{closure}}
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0/src/task_pool.rs:343:22
11:39:16 [macos] 12: std::thread::local::LocalKey<T>::try_with
11:39:16 [macos] at /Users/connormeehan/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:315:12
11:39:16 [macos] 13: std::thread::local::LocalKey<T>::with
11:39:16 [macos] at /Users/connormeehan/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:279:20
11:39:16 [macos] 14: bevy_tasks::task_pool::TaskPool::scope_with_executor
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_tasks-0.16.0/src/task_pool.rs:339:31
11:39:16 [macos] 15: <bevy_ecs::schedule::executor::multi_threaded::MultiThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/executor/multi_threaded.rs:221:57
11:39:16 [macos] 16: bevy_ecs::schedule::schedule::Schedule::run
11:39:16 [macos] at /Users/connormeehan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/schedule/schedule.rs:448:14
11:39:16 [macos] 17: bevy_ecs::world::World::try_run_schedule::{{closure}}
11:39:16 [macos] 18: bevy_ecs::world::World::try_schedule_scope
11:39:16 [macos] 19: bevy_ecs::world::World::try_run_schedule
11:39:16 [macos] 20: <bevy_app::app::App as bevy_simple_subsecond_system::hot_patched_app::HotPatchedAppExt>::with_hot_patch::{{closure}}
11:39:16 [macos] 21: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
11:39:16 [macos] 22: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn() .> Out>>::run::call_inner
11:39:16 [macos] 23: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn() .> Out>>::run
11:39:16 [macos] 24: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe::{{closure}}
11:39:16 [macos] 25: bevy_ecs::world::World::last_change_tick_scope
11:39:16 [macos] 26: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
11:39:16 [macos] 27: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::run_unsafe
11:39:16 [macos] 28: bevy_ecs::system::system::System::run_without_applying_deferred
11:39:16 [macos] 29: bevy_ecs::system::system::System::run
11:39:16 [macos] note: Some "noisy" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.
11:39:16 [macos] Encountered a panic in system `<bevy_app::app::App as bevy_simple_subsecond_system::hot_patched_app::HotPatchedAppExt>::with_hot_patch<bug::main::{{closure}}>::{{closure}}`!
11:39:16 [macos] Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
11:39:16 [dev] Application [macos] exited with error: exit status: 101
Workaround
Use setup systems to initialise your resources.
Metadata
Metadata
Assignees
Labels
No labels