diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 0a14e5e140..bb7299195d 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -750,6 +750,10 @@ impl World { /// The value given by the [`FromWorld::from_world`] method will be used. /// Note that any resource with the `Default` trait automatically implements `FromWorld`, /// and those default values will be here instead. + /// + /// # Panics + /// + /// Panics if called from a thread other than the main thread. #[inline] pub fn init_non_send_resource(&mut self) { if !self.contains_resource::() { @@ -763,6 +767,10 @@ impl World { /// `NonSend` resources cannot be sent across threads, /// and do not need the `Send + Sync` bounds. /// Systems with `NonSend` resources are always scheduled on the main thread. + /// + /// # Panics + /// + /// Panics if called from a thread other than the main thread. #[inline] pub fn insert_non_send_resource(&mut self, value: R) { self.validate_non_send_access::();