/// <summary>
/// 获取 AB 源文件路径(打包进安装包的)
/// </summary>
/// <param name="path"></param>
/// <param name="forWWW"></param>
/// <returns></returns>
public static string GetBundleSourceFile(string path, bool forWWW = true)
{
string filePath = null;
#if UNITY_EDITOR
if (forWWW)
filePath = string.Format("file://{0}/StreamingAssets/{1}/{2}", Application.dataPath, BundleSaveDirName,
path);
else
filePath = string.Format("{0}/StreamingAssets/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
#elif UNITY_STANDALONE_WIN
if (forWWW)
filePath =
string.Format("file://{0}/StreamingAssets/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
else
filePath = string.Format("{0}/StreamingAssets/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
#elif UNITY_ANDROID
if (forWWW)
filePath =
string.Format("jar:file://{0}!/assets/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
else
filePath = string.Format("{0}!assets/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
#elif UNITY_IOS
if (forWWW)
filePath = string.Format("file://{0}/Raw/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
else
filePath = string.Format("{0}/Raw/{1}/{2}", Application.dataPath, BundleSaveDirName, path);
#else
throw new System.NotImplementedException();
#endif
// LuaInterface.Debugger.Log(string.Format("{1}:[{0}]", filePath, "filePath34445"));
return filePath;
}
网友评论