XRSettingsWrapper.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (c) 2022 Vuplex Inc. All rights reserved.
  2. //
  3. // Licensed under the Vuplex Commercial Software Library License, you may
  4. // not use this file except in compliance with the License. You may obtain
  5. // a copy of the License at
  6. //
  7. // https://vuplex.com/commercial-library-license
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. using UnityEngine;
  15. #if UNITY_2017_2_OR_NEWER
  16. using UnityEngine.XR;
  17. #else
  18. using XRSettings = UnityEngine.VR.VRSettings;
  19. #endif
  20. namespace Vuplex.WebView.Internal {
  21. /// <summary>
  22. /// Utility class to help manage the name change from VRSettings
  23. /// to XRSettings that occurred in Unity 2017.2.
  24. /// </summary>
  25. public class XRSettingsWrapper {
  26. public static XRSettingsWrapper Instance {
  27. get {
  28. if (_instance == null) {
  29. _instance = new XRSettingsWrapper();
  30. }
  31. return _instance;
  32. }
  33. }
  34. public bool enabled { get { return XRSettings.enabled; }}
  35. public RenderTextureDescriptor eyeTextureDesc { get { return XRSettings.eyeTextureDesc; }}
  36. public string loadedDeviceName { get { return XRSettings.loadedDeviceName; }}
  37. public string[] supportedDevices { get { return XRSettings.supportedDevices; }}
  38. static XRSettingsWrapper _instance;
  39. }
  40. }