x


How to dispaly list of images from server on GUI?

Hi,

I want to display a list of images inside a GUI ScrollView. The images are located on a web server, and my only reference to them is a string array with their respective absolute paths (http://domain/images/xx.jpg...)

So far I've tried to put each image on a label as a texture in OnGUI():

// inside for loop

var thumb : WWW = new WWW(filesArray[i]);

yield thumb;

GUI.Label(Rect(x,y,h,w), thumb.texture, "box");

However, the OnGUI() function will not allow me to 'yield'.

If I load each texture in the Start() function, it falls behind the OnGUI() function, and errors occur because OnGUI() tries to apply a texture that hasn't been loaded yet.

Is there any way I can make OnGUI() wait for Start() to finish, or is there a better way of achieving what I want?

/ Rendse

more ▼

asked Sep 14 '11 at 10:09 PM

Rendse gravatar image

Rendse
1 2 2 2

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

1 answer: sort voted first

Well, one way to do this would be to assign a boolean "loaded", and set it to true when the WWW returns. Then in OnGUI, you would check against that, and only try to display images when it is true.

more ▼

answered Sep 15 '11 at 01:49 AM

syclamoth gravatar image

syclamoth
14.8k 7 15 80

(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:

x2207
x335
x244
x54

asked: Sep 14 '11 at 10:09 PM

Seen: 1112 times

Last Updated: Sep 15 '11 at 01:49 AM