Example #1
0
        public static string GetStreamingAssetsPath(this string relativePath, URLHead urlHead = URLHead.None)
        {
            // https://docs.unity3d.com/2018.4/Documentation/ScriptReference/WWW.html
            switch (urlHead)
            {
            case URLHead.None:
                break;

            case URLHead.File: {
                if (Application.platform != RuntimePlatform.Android)
                {
                    return(Path.Combine("file://" + Application.streamingAssetsPath, relativePath));
                }
            }
            break;

            case URLHead.Http:
                return(Path.Combine("http://" + Application.streamingAssetsPath, relativePath));

            case URLHead.Https:
                return(Path.Combine("https://" + Application.streamingAssetsPath, relativePath));

            case URLHead.Ftp:
                return(Path.Combine("ftp://" + Application.streamingAssetsPath, relativePath));
            }
            return(Path.Combine(Application.streamingAssetsPath, relativePath));
        }
Example #2
0
 public static string GetAssetBundlePath(this string assetBundleName,
                                         bool persistentData = true, URLHead urlHead = URLHead.File)
 {
     if (persistentData)
     {
         if (string.IsNullOrEmpty(ASSETBUNDLES_FOLDER_NAME))
         {
             return(GetPersistentDataPath(assetBundleName));
         }
         return(GetPersistentDataPath(Path.Combine(ASSETBUNDLES_FOLDER_NAME, assetBundleName)));
     }
     if (string.IsNullOrEmpty(ASSETBUNDLES_FOLDER_NAME))
     {
         return(GetStreamingAssetsPath(assetBundleName, urlHead));
     }
     return(GetStreamingAssetsPath(Path.Combine(ASSETBUNDLES_FOLDER_NAME, assetBundleName), urlHead));
 }