Filling GUI.BeginScrollView with images

Hey all,

within my GUI you’ll see this:

Function OnGUI(){
    scrollViewVector = GUI.BeginScrollView (new Rect (140, 10, 768, 532), scrollViewVector, new Rect (0, 0, 12000, 512));
    		
    			for(var i=0;i<images.Length;i++){
    
    				GUI.DrawTexture(Rect (0, 0, 768, 512), images*);*
  •  	}*
    
  •  	GUI.EndScrollView ();*
    
  •  }*
    

What, I’m trying to do is populate the scroll box with images, but the loop only shows the last one (which I understand why) what i don’t know how to do is basically retrun all array elements? So I ask how I would do that…
Thanks, Josh.

So instead of specifying the same position for all the textures (Rect(0,0,768,512)), you could do one of two things:

  1. Increment the position for each image:

    for(var i=0;i<images.Length;i++){
        GUI.DrawTexture(Rect (0, i*512, 768, (i+1)*512), images*);*
    

}
2. Or let GUILayout do the work:
for(var i=0;i<images.Length;i++){
GUILayout.Label(images*);*
}