OpenVRLoaderMetadata.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #if XR_MGMT_GTE_320
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Unity.XR.OpenVR;
  5. using UnityEditor;
  6. using UnityEngine;
  7. using UnityEngine.XR.Management;
  8. using UnityEditor.XR.Management.Metadata;
  9. class OpenVRPackage : IXRPackage
  10. {
  11. private class OpenVRLoaderMetadata : IXRLoaderMetadata
  12. {
  13. public string loaderName { get; set; }
  14. public string loaderType { get; set; }
  15. public List<BuildTargetGroup> supportedBuildTargets { get; set; }
  16. }
  17. private class OpenVRPackageMetadata : IXRPackageMetadata
  18. {
  19. public string packageName { get; set; }
  20. public string packageId { get; set; }
  21. public string settingsType { get; set; }
  22. public List<IXRLoaderMetadata> loaderMetadata { get; set; }
  23. }
  24. private static IXRPackageMetadata s_Metadata = new OpenVRPackageMetadata()
  25. {
  26. packageName = "OpenVR XR Plugin",
  27. packageId = "com.valvesoftware.unity.openvr",
  28. settingsType = "Unity.XR.OpenVR.OpenVRSettings",
  29. loaderMetadata = new List<IXRLoaderMetadata>() {
  30. new OpenVRLoaderMetadata() {
  31. loaderName = "OpenVR Loader",
  32. loaderType = "Unity.XR.OpenVR.OpenVRLoader",
  33. supportedBuildTargets = new List<BuildTargetGroup>() {
  34. BuildTargetGroup.Standalone
  35. }
  36. },
  37. }
  38. };
  39. public IXRPackageMetadata metadata => s_Metadata;
  40. public bool PopulateNewSettingsInstance(ScriptableObject obj)
  41. {
  42. OpenVRSettings packageSettings = obj as OpenVRSettings;
  43. if (packageSettings != null)
  44. {
  45. // Do something here if you need to...
  46. }
  47. return true;
  48. }
  49. }
  50. #endif