add plugin by default and fix compile errors

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-05-15 22:37:39 +02:00
parent 764da56d50
commit d90558ebc9
2 changed files with 5 additions and 4 deletions

View File

@@ -1,10 +1,10 @@
use crate::{init::OxrPreUpdateSet, resources::OxrSession};
use bevy::prelude::*;
use bevy_xr::session::{session_running, status_changed_to};
use bevy_xr::session::session_running;
impl Plugin for OxrActionSyncingPlugin {
fn build(&self, app: &mut App) {
app.add_event::<OxrAttachActionSet>();
app.add_event::<OxrSyncActionSet>();
app.add_systems(
PreUpdate,
sync_sets
@@ -18,14 +18,14 @@ fn sync_sets(session: Res<OxrSession>, mut events: EventReader<OxrSyncActionSet>
let sets = events
.read()
.map(|v| &v.0)
.map(|s| openxr::ActionSet::from(s))
.map(openxr::ActiveActionSet::new)
.collect::<Vec<_>>();
if sets.is_empty() {
return;
}
if let Err(err) = session.sync_actions(sets) {
if let Err(err) = session.sync_actions(&sets) {
warn!("error while syncing actionsets: {}", err.to_string());
}
}