NRStubHelper.cs 1.3 KB

123456789101112131415161718192021222324252627
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. using UnityEngine;
  10. using UnityEditor;
  11. using System;
  12. public class NRStubHelper : ScriptableObject
  13. {
  14. // Stub helper class to locate NReal Utilities Path through Unity Editor API.
  15. public static bool IsInsideUnityPackage()
  16. {
  17. var so = ScriptableObject.CreateInstance(typeof(NRStubHelper));
  18. var script = MonoScript.FromScriptableObject(so);
  19. string assetPath = AssetDatabase.GetAssetPath(script);
  20. if (assetPath.StartsWith("Packages\\", StringComparison.InvariantCultureIgnoreCase) ||
  21. assetPath.StartsWith("Packages/", StringComparison.InvariantCultureIgnoreCase))
  22. return true;
  23. return false;
  24. }
  25. }