hey
I’m making a small application, yes application (lol) with Unity for my friends who kindly asked me to do it.
I thought I’ll do it in Unity so they’d be able to use online with webplayer build.
Now I need to make it so it’d download a file from specified url to a specified folder when they click a button.
Before even starting I made a quick test to see whether it will work or not.
It works in editor and in standalone app, but it doesn’t work in webplayer :S
Here’s the code:
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
public class NewBehaviourScript1 : MonoBehaviour {
public GUIText test;
string urlas = @"http://www.onedotnetway.com/wp-content/uploads/2008/08/image35.png";
string diskas = @"z:\image35.png";
// Use this for initialization
void Start () {
try
{
System.Net.WebClient client = new WebClient();
client.DownloadFile(urlas, diskas);
}
catch(Exception e)
{
print(e.ToString());
test.text = "error: " + e.ToString() + " ";
}
}
// Update is called once per frame
void Update () {
}
}
It gives the following error when ran in webplayer:
Any way to fix or bypass that? Am I missing something?
Cheers