WebClient class is giving different result in Editor and in Android build.
void Start () {
path = Application.persistentDataPath;
#if UNITY_EDITOR
path = "D:/data";
#endif
client.DownloadProgressChanged += Progress;
client.DownloadFileCompleted += Completed;
client.DownloadFileAsync (new Uri(url), path+"/version");
}
public void Progress(object sender, DownloadProgressChangedEventArgs e)
{
Debug.Log(e.ProgressPercentage);
}
public void Completed(object sender, AsyncCompletedEventArgs e)
{
if (e.Error != null || e.Cancelled) {
Debug.Log(e.Error.Message);
}
else
{
Debug.Log("Successfully Completed");
}
}
When run from Unity Editor the file was downloaded fine. But when build for Android it gives a error message as Name Resolution Failure.
It gives the same error when there is no Internet Connection when running on Unity Editor. But I get the error message in Android whether the device is connected to internet or not.
url?D:/dataa folder or the file?