ARAbilities.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnityEditor;
  2. using UnityEngine;
  3. using UnityEngine.EventSystems;
  4. namespace EZXR.Glass.Core
  5. {
  6. public partial class ARAbilities : MonoBehaviour
  7. {
  8. #region InputSystem
  9. [MenuItem("GameObject/XR Abilities/InputSystem", false, 20)]
  10. public static void EnableInputSystem()
  11. {
  12. if (FindObjectOfType<EZXR.Glass.Inputs.InputSystem>() == null)
  13. {
  14. string filePath = "Assets/EZXRGlassSDK/Core/InputSystem/Prefabs/InputSystem.prefab";
  15. if (AssetDatabase.LoadAssetAtPath<GameObject>(filePath) == null)
  16. {
  17. filePath = AssetDatabase.GUIDToAssetPath("4c1509f78a7904c9980227d2731ebe61");
  18. }
  19. Core.PrefabUtility.InstantiatePrefabWithUndoAndSelection(AssetDatabase.LoadAssetAtPath<GameObject>(filePath));
  20. }
  21. }
  22. #endregion
  23. #region EventSystem
  24. [MenuItem("GameObject/XR Abilities/Additional.../EventSystem", false, 20)]
  25. public static void EnableEventSystem()
  26. {
  27. if (FindObjectOfType<HandInputModule>() == null)
  28. {
  29. string filePath = "Assets/EZXRGlassSDK/Core/HandTracking/Resources/EventSystem.prefab";
  30. if (AssetDatabase.LoadAssetAtPath<GameObject>(filePath) == null)
  31. {
  32. filePath = AssetDatabase.GUIDToAssetPath("6e33b2edc7ac4784ebe0163210ea60f2");
  33. }
  34. Core.PrefabUtility.InstantiatePrefabWithUndoAndSelection(AssetDatabase.LoadAssetAtPath<GameObject>(filePath));
  35. }
  36. }
  37. #endregion
  38. }
  39. }