x


How to download an asset bundle to local hard drive?

How can I download an asset bundle (in a standalone app, not web player) and save it to a folder on the local hard drive?

I know how to download one and then instantiate it, but I'm not clear on the saving to hard drive part.

more ▼

asked Jun 14 '10 at 06:25 AM

Ony gravatar image

Ony
888 29 36 48

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

Ok I got it figured out so I'll put it here for anyone else looking. If anyone has a better way to do it please post here:

import http://System.IO;
var path = "local path on hard drive to write to";

function SaveDownloaded(filename)
{

    Debug.Log("Attempting to download this file: "+filename);

    var fileURL = "www.yourdomain.com/assets/"+filename;
    var www : WWW = new WWW (fileURL);
    yield www;

    var bytes = www.bytes;
    File.WriteAllBytes(path+"/" + filename, bytes);

} 
more ▼

answered Jun 14 '10 at 06:49 AM

Ony gravatar image

Ony
888 29 36 48

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x382
x195
x134

asked: Jun 14 '10 at 06:25 AM

Seen: 2643 times

Last Updated: Jun 14 '10 at 06:25 AM