Merge pull request #118 from Schmarni-Dev/readd-action-sync-set
Re Add action set sync SystemSet
This commit is contained in:
@@ -28,7 +28,7 @@ impl Plugin for OxrActionBindingPlugin {
|
|||||||
|
|
||||||
// This could for now be handled better with a SystemSet, but in the future we might want to add an
|
// This could for now be handled better with a SystemSet, but in the future we might want to add an
|
||||||
// Event to allow requesting binding suggestion for new actions
|
// Event to allow requesting binding suggestion for new actions
|
||||||
fn run_action_binding_sugestion(world: &mut World) {
|
pub(crate) fn run_action_binding_sugestion(world: &mut World) {
|
||||||
world.run_schedule(OxrSendActionBindings);
|
world.run_schedule(OxrSendActionBindings);
|
||||||
world.run_system_once(bind_actions);
|
world.run_system_once(bind_actions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
use crate::session::{OxrSession, OxrSessionStatusEvent};
|
use crate::{action_binding::run_action_binding_sugestion, session::{OxrSession, OxrSessionStatusEvent}};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::session::status_changed_to;
|
|
||||||
|
|
||||||
impl Plugin for OxrActionAttachingPlugin {
|
impl Plugin for OxrActionAttachingPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_event::<OxrAttachActionSet>();
|
app.add_event::<OxrAttachActionSet>();
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
attach_sets.run_if(|mut session_status_event: EventReader<OxrSessionStatusEvent>| {
|
attach_sets
|
||||||
|
.run_if(
|
||||||
|
|mut session_status_event: EventReader<OxrSessionStatusEvent>| {
|
||||||
session_status_event
|
session_status_event
|
||||||
.read()
|
.read()
|
||||||
.any(|s| *s == OxrSessionStatusEvent::Created)
|
.any(|s| *s == OxrSessionStatusEvent::Created)
|
||||||
}),
|
},
|
||||||
|
)
|
||||||
|
.after(run_action_binding_sugestion),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ use crate::session::OxrSession;
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::session::session_running;
|
use bevy_xr::session::session_running;
|
||||||
|
|
||||||
|
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||||
|
pub struct OxrActionSetSyncSet;
|
||||||
|
|
||||||
impl Plugin for OxrActionSyncingPlugin {
|
impl Plugin for OxrActionSyncingPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_event::<OxrSyncActionSet>();
|
app.add_event::<OxrSyncActionSet>();
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PreUpdate,
|
PreUpdate,
|
||||||
sync_sets.run_if(session_running), // .in_set(OxrPreUpdateSet::SyncActions),
|
sync_sets.in_set(OxrActionSetSyncSet).run_if(session_running), // .in_set(OxrPreUpdateSet::SyncActions),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user