Define.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. namespace ET
  2. {
  3. public static class Define
  4. {
  5. #if UNITY_EDITOR && !ASYNC
  6. public static bool IsAsync = false;
  7. #else
  8. public static bool IsAsync = true;
  9. #endif
  10. #if UNITY_EDITOR
  11. public static bool IsEditor = true;
  12. #else
  13. public static bool IsEditor = false;
  14. #endif
  15. #if USE_LUA
  16. public static bool UseLua = true;
  17. #else
  18. public static bool UseLua = false;
  19. #endif
  20. public static UnityEngine.Object LoadAssetAtPath(string s)
  21. {
  22. #if UNITY_EDITOR
  23. return UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(s);
  24. #else
  25. return null;
  26. #endif
  27. }
  28. public static string[] GetAssetPathsFromAssetBundle(string assetBundleName)
  29. {
  30. #if UNITY_EDITOR
  31. return UnityEditor.AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName);
  32. #else
  33. return new string[0];
  34. #endif
  35. }
  36. public static string[] GetAssetBundleDependencies(string assetBundleName, bool v)
  37. {
  38. #if UNITY_EDITOR
  39. return UnityEditor.AssetDatabase.GetAssetBundleDependencies(assetBundleName, v);
  40. #else
  41. return new string[0];
  42. #endif
  43. }
  44. }
  45. }