Unity开发时使用的多平台的读取流式资源StreamingAssets文件夹路径读取,当平台为安卓时,读取根目录/StreamingAssets/包名 所在的文件夹。
public static string path()
{
string path;
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
path = Application.streamingAssetsPath;
#else
path = "/storage/emulated/0/StreamingAssets/"+Application.identifier;
#endif
DirectoryCheck(path+"/");
return path + "/";
}
/// <summary>
/// 检查路径是否存在
/// </summary>
/// <param name="path"></param>
public static void DirectoryCheck(string path)
{
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
}