fix xr_utils_actions crashing when running without an openxr runtime
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -58,6 +58,7 @@ use bevy_openxr::{
|
||||
action_binding::OxrSuggestActionBinding, action_set_attaching::OxrAttachActionSet,
|
||||
resources::OxrInstance, session::OxrSession,
|
||||
};
|
||||
use bevy_xr::session::{session_available, session_running};
|
||||
use openxr::{ActiveActionSet, Path, Vector2f};
|
||||
use std::borrow::Cow;
|
||||
|
||||
@@ -66,30 +67,29 @@ impl Plugin for XRUtilsActionsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(
|
||||
Startup,
|
||||
create_openxr_events.in_set(XRUtilsActionSystemSet::CreateEvents),
|
||||
);
|
||||
app.add_systems(
|
||||
Update,
|
||||
sync_active_action_sets.run_if(resource_exists::<OxrSession>),
|
||||
create_openxr_events
|
||||
.in_set(XRUtilsActionSystemSet::CreateEvents)
|
||||
.run_if(session_available),
|
||||
);
|
||||
app.add_systems(Update, sync_active_action_sets.run_if(session_running));
|
||||
app.add_systems(
|
||||
Update,
|
||||
sync_and_update_action_states_f32
|
||||
.run_if(resource_exists::<OxrSession>)
|
||||
.run_if(session_running)
|
||||
.in_set(XRUtilsActionSystemSet::SyncActionStates)
|
||||
.after(sync_active_action_sets),
|
||||
);
|
||||
app.add_systems(
|
||||
Update,
|
||||
sync_and_update_action_states_bool
|
||||
.run_if(resource_exists::<OxrSession>)
|
||||
.run_if(session_running)
|
||||
.in_set(XRUtilsActionSystemSet::SyncActionStates)
|
||||
.after(sync_active_action_sets),
|
||||
);
|
||||
app.add_systems(
|
||||
Update,
|
||||
sync_and_update_action_states_vector
|
||||
.run_if(resource_exists::<OxrSession>)
|
||||
.run_if(session_running)
|
||||
.in_set(XRUtilsActionSystemSet::SyncActionStates)
|
||||
.after(sync_active_action_sets),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user