Ultimately, I my goal is to just update my StreamingAssets Data directories, via directories on the web server.
I am trying to download an entire directory of files from a web server to be able to update the files for my game. (folder structure matters)
Currently, the files I am using have an organized hierarchy structure inside of my StreamingAssets folder that are read during runtime. As the game starts, it compares a versioning text file to the server's versioning and if they differ, it should update to the server's files.
Now I am successfully able to get that single file and compare its text, however I am unaware as to how I can get ahold of the entire directory of files and their subfolders to update and replace the files in my StreamingAssets data.
Hopefully I am asking a dumb question, but also there may be an entirely better answer to achieve my goal, please let me know where to look/ what you guys would all do.
This is how I get my Versioning Check:
IEnumerator readOnlineCardVersion()
{
VersionTextFile = UnityWebRequest.Get("http://www.myserver.com/SteamingAssets/FlashCards_Version.txt");
if (workingOnline)
{
UnityWebRequest www = VersionTextFile;
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
// Show results as text
Debug.Log(www.downloadHandler.text); //.downloadHandler.);
// Or retrieve results as text
onlineCardVersion = www.downloadHandler.text;
}
}
else
{
#region LocalTest
//Read the text from directly from the test.txt file
StreamReader reader = new StreamReader(onlineFolderPath + "StreamingAssets/FlashCards_Version.txt");
using (reader)
onlineCardVersion = reader.ReadToEnd();
//Debug.Log("." + onlineCardVersion + ".");
reader.Close();
#endregion
}
}
Basically, I can retrieve individual files simply, but how can I recursively acquire all files in a particular web directory.
Aucun commentaire:
Enregistrer un commentaire