-
I have some non Clone, non Sync data (wrapped in SyncCell) that I'd like to transfer from my main app to the render app. Is there a good way to go about doing this? Alternatively, is there a good way to initialize a resource one time in the render world? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Okay, I seem to have accomplished this by adding a system to let render_app = app.sub_app_mut(RenderApp);
render_app.add_systems(ExtractSchedule, get_comms.run_if(check_comms))
// ...
fn check_comms(maybe_comms: Option<Res<Comms>>) -> bool {
maybe_comms.is_none()
}
fn get_comms(mut commands: Commands, mut world: ResMut<MainWorld>) {
let comms = world.remove_resource::<Comms>().unwrap();
commands.insert_resource(comms);
} And now I can add a system to the render app that uses |
Beta Was this translation helpful? Give feedback.
-
hi hi, i just saw your answer and wondered if there is also a feature working the other way around? |
Beta Was this translation helpful? Give feedback.
Okay, I seem to have accomplished this by adding a system to
ExtractSchedule
with theMainWorld
resource as a parameter:And now I can add a system to the render app that uses
Comms
. Not sure if there is a better way but works for me.