Application.persistentDataPath but for a Build
I'm creating a game launcher for my work and I have it to where I can download zip files from google drive, unzip the file, and then execute the game. I'm trying use UniZip and it works for the editor! It did everything I need it to, except it doesn't work when I try it on a Build. I know it's bc persistentDataPath only works for the editor and not a Build, so what does? I looked it up and I read some pages on GUID but I don't know how to access or utilize that. Does anyone have any answers?
Here's the code if anyone needs it.
IEnumerator DownloadFile(string url, string zipname)
{
UnityWebRequest uwr = new UnityWebRequest(url, UnityWebRequest.kHttpVerbGET);
string path = Path.Combine(Application.persistentDataPath, zipname);
uwr.downloadHandler = new DownloadHandlerFile(path);
yield return uwr.SendWebRequest();
//if (uwr.Result != UnityWebRequest.Result.Success)
// Debug.LogError(uwr.error);
//else
Debug.Log("File successfully downloaded and saved to " + path);
UnzipFile(zipname);
}
void UnzipFile(string zipname)
{
Debug.Log("Starting Unzip Function");
string path = Path.Combine(Application.persistentDataPath, zipname);
string exportLocation = Application.persistentDataPath;
ZipUtil.Unzip(path, exportLocation);
Debug.Log("Finished it hopefully");
}
persistent data path is just a path to a directory in the device, and works on build. you need to give some extra details to understand what happens
@xxmariofer do you know what details I need to add? I've looked through all the docs I could find but I can't find anything.
I mean details of your issue, it returns any errors? Could you try a different device? I think I've used that same unzip library, (the class and method names are the same) and gave me issues when unzipping big zip files. Could you please tell me if the code returns any errors or what it happens?