GUI Error:
You are pushing more GUIClips than you are popping.
Make sure they are balanced (type:Layout)
I think it's pointing to this code: (it is slighty modified - the real code is far more complex ;) )
var imageTexture:Texture=null;
var MyLib:MyLibClass=null;
var p:MyPictureObject=null;
function Start(){
p=MyLib.GetARandomPicture();
}
function OnGUI(){
if (imageTexture==null){
var url=p.GetImage();
if (url!="" && p.IsBusy()==false){
p.SetBusy(true);
Debug.Log("getting an image texture",this);
if (p.GetImageTexture()!=null){
Debug.Log("getting an image texture from cache",this);
imageTexture=p.GetImageTexture();
} else {
Debug.Log("getting an image texture from web: "+url,this);
var www=new WWW(url);
yield www;
p.SetimageTexture(www.texture);
imageTexture=www.texture;
}
p.SetBusy(false);
}
}
GUILayout.Box(Rect(0,0,100,100), imageTexture);
if (GUILayout.Button("a different image please")){
p=MyLib.GetARandomPicture();
}
}
I use p.SetBusy() and p.IsBusy() to avoid multiple requests for one image.
I use p.GetImageTexture() and p.SetImageTexture() for caching request responses.
So If I use caching and avoid asyncronous problems - why do I get something like a stackoverflow on the request buffer?