x


few questions about using www for getting bunch of images...

the thing i made works in editor and it is using www to get the images and show them as textures. here is the part that does that:

// Start a download of the given URL
var www = new WWW("file://"+imageListFullPath[currentImageIndex]); 

// wait until the download is done
yield www; 

// assign the downloaded image to the main texture of the object
tImages=www.texture;

this works good in the editor, ofcourse i am using http:// protocol when webplayer is uploaded to a server. but it does not work. it freezes. so to figure out what is going on i have to ask somebody more experienced to help me.

1.) to get the list of all images in the folder i use this call from http://System.IO:

if(Directory.Exists(imageDir)){

  //GET THE LIST OF IMAGES IN THE DIRECTORY
  var images : String[]=Directory.GetFiles(imageDir+shortName+"/");

}

is this making a problem? can i get the list of files inside the folder through web player if the files are on the same server, i know that webplayer can not access local files from secuirty reasons?

2.) When running from the editor, the folder that contains images is located here Application.dataPath+"/imageDir/", it seems that this is asset folder, so any change to this folder, like adding images to it, unity reimports assets. is this really needed, can i use some generic folder path that is outside of the asset folder?

3.) When webplayer is built, where to put the image folder in relation to webplayer so i can read the files properly. This goes for local webplayer and uploaded to server?

4.) Can anything be done with memory leak that is caused by downloading textures this way, memory does not go free when textures are not used any more?

I was frustrated the most of things worked properly in editor but when i tried to upload to server it crashed. basically it could be something really simple but i can not see it...

Thanks in advance for looking into this, it's appreciated!

more ▼

asked Nov 19 '11 at 08:30 PM

pretender gravatar image

pretender
512 122 134 146

any ideas here?

Nov 20 '11 at 05:59 PM pretender

You can't use System.IO in a webplayer, period. Any web access has to go through WWW.

Nov 20 '11 at 07:02 PM Eric5h5
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x548
x428
x264
x200
x4

asked: Nov 19 '11 at 08:30 PM

Seen: 783 times

Last Updated: Nov 20 '11 at 07:02 PM