Skip to content

Commit

Permalink
prevent error in case bevy_sync not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaeleragni committed Sep 3, 2024
1 parent b7c2ec4 commit 406cf93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_sync"
version = "0.14.1"
version = "0.14.2"
edition = "2021"
authors = ["Raffaele Ragni <raffaele.ragni@gmail.com>"]
license = "MIT OR Apache-2.0"
Expand Down
6 changes: 6 additions & 0 deletions src/lib_priv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ impl SyncComponent for App {
>(
&mut self,
) -> &mut Self {
// application may try to setup sync without knowing if bevy_sync was enabled.
if self.world().get_resource::<SyncTrackerRes>().is_none() {
warn!("Trying to register sync_component in bevy_sync, but bevy_sync is not enabled.");
return self;
}

self.register_type::<T>();
self.register_type_data::<T, ReflectFromReflect>();
let c_id = self.world_mut().init_component::<T>();
Expand Down

0 comments on commit 406cf93

Please sign in to comment.