PersistentHelper.cs 703 B

12345678910111213141516171819202122232425262728
  1. 
  2. namespace YooAsset
  3. {
  4. internal static class PersistentHelper
  5. {
  6. /// <summary>
  7. /// 获取WWW加载本地资源的路径
  8. /// </summary>
  9. public static string ConvertToWWWPath(string path)
  10. {
  11. #if UNITY_EDITOR
  12. return StringUtility.Format("file:///{0}", path);
  13. #elif UNITY_WEBGL
  14. return path;
  15. #elif UNITY_IPHONE
  16. return StringUtility.Format("file://{0}", path);
  17. #elif UNITY_ANDROID
  18. return path;
  19. #elif UNITY_STANDALONE_OSX
  20. return new System.Uri(path).ToString();
  21. #elif UNITY_STANDALONE
  22. return StringUtility.Format("file:///{0}", path);
  23. #else
  24. return path;
  25. #endif
  26. }
  27. }
  28. }