- Home /
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
Answer by syclamoth · Sep 15, 2011 at 01:49 AM
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.
Your answer
Follow this Question
Related Questions
3 general questions about sprite/texture 1 Answer
Create a texture dynamically 1 Answer
GUI.Box not showing Texture on device 1 Answer
Player Looking in Opposite Direction 1 Answer
Yield not working within OnGUI() 2 Answers