1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System.Collections.Generic;
- using UnityEngine.XR;
- using UnityEngine.XR.Management;
- #if UNITY_EDITOR
- using UnityEditor;
- using UnityEditor.XR.Management;
- #endif
- namespace Samples
- {
-
-
-
-
-
- #if UNITY_EDITOR
- [XRSupportedBuildTarget(BuildTargetGroup.Standalone, new BuildTarget[]{ BuildTarget.StandaloneWindows, BuildTarget.StandaloneWindows64})]
- [XRSupportedBuildTarget(BuildTargetGroup.Android)]
- #endif
- public class SampleLoader : XRLoaderHelper
- {
- static List<XRInputSubsystemDescriptor> s_InputSubsystemDescriptors =
- new List<XRInputSubsystemDescriptor>();
-
- public XRInputSubsystem inputSubsystem
- {
- get { return GetLoadedSubsystem<XRInputSubsystem>(); }
- }
- SampleSettings GetSettings()
- {
- SampleSettings settings = null;
-
-
- #if UNITY_EDITOR
- UnityEditor.EditorBuildSettings.TryGetConfigObject(SampleConstants.k_SettingsKey, out settings);
- #else
- settings = SampleSettings.s_RuntimeInstance;
- #endif
- return settings;
- }
- #region XRLoader API Implementation
-
-
- public override bool Initialize()
- {
- SampleSettings settings = GetSettings();
- if (settings != null)
- {
-
- }
- CreateSubsystem<XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "InputSubsystemDescriptor");
- return false;
- }
-
-
- public override bool Start()
- {
- StartSubsystem<XRInputSubsystem>();
- return true;
- }
-
-
- public override bool Stop()
- {
- StopSubsystem<XRInputSubsystem>();
- return true;
- }
-
-
- public override bool Deinitialize()
- {
- DestroySubsystem<XRInputSubsystem>();
- return base.Deinitialize();
- }
- #endregion
- }
- }
|