Button list from array

I want to create a list of buttons from an array, with for each button a texture, but how can i place buttons, with each a specific position and it’s own texture and values from an array.
The whole idea behind this is to create some kind of app drawer for windows, so each button has to open a specific program on the computer.
If anyone has an idea about this. please let me know

Just create a struct with two public members (“Rect buttonRect” and “Texture buttonTexture”), finally declare the list object as array of your struct

If you're generating buttons in a pattern, you can use for loops. Example:

function OnGUI(){
    for (var 1 : int = 0; i <= yourArray.length; i++){
        yourArray _= GUI.Button(Rect(10*i,0,10,10),image*);*_
 <em>_if (yourAray*){*_</em>
 <em>_*//Your code here*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
<em>_*}*_</em>
<em>_*```*_</em>
<em>_*<p>This will mass create and check buttons in each array item. It's important to say that `yourArray` will hold the buttons (boolean value), not their content. Just put your code in the defined spade and you're done.*_</em>
<em>_*P.S.: This example will create a row of buttons. It's recommendable that you use a grid generator intead if you plan to display multiple rows (that's very easy to find).</p>*_</em>
<em>_*<p>`image` is the array of icons for your buttons. You can also use text if youd efine as a String array.</p>*_</em>

I just gave someone else an example of creating a grid of buttons from a multidimentional array on this question… Infect the blank cubes

Take a look at it. It might me of some help to you as well.

-Larry

Problem with that, is it uses 1 draw call per button, very slow, for like 10x10 buttons is 100 draw calls. here is a button using whatever texture you want, it returns number of button clicked on your texture:

  function OnGUI(){
			var gridpixels = 20;//pixels per grid square
			var gidxsquares = 12;//num squares in x direction
			if (GUI.Button(Rect(320,10,240,60),fctbutton,GUIStyle.none))
	{
			var xpos = Input.mousePosition.x - 320 ;
			var ypos = Screen.height - Input.mousePosition.y -10;
			
			var result =  Mathf.Floor(xpos / gridpixels) + Mathf.Floor(ypos / gridpixels)*gidxsquares + 1;//plus 1 at end for not zero first square
			//
			print (result);
	}	

}