Multiple buttons on gui

Hello,

I want to draw 5 buttons to screen. How to do this?

function OnGUI(){
       if( GUILayout.Button("hello") )
          //Stuff
       if( GUILayout.Button("hello") )
          //Stuff
       if( GUILayout.Button("hello") )
          //Stuff
       if( GUILayout.Button("hello") )
          //Stuff
       if( GUILayout.Button("hello") )
          //Stuff
}

http://forum.unity3d.com/threads/113438-Centering-GUI?p=1150803&viewfull=1#post1150803

http://forum.unity3d.com/threads/168443-Question-Image-based-gui-issue?p=1152661&viewfull=1#post1152661

or you can just use the GUIButton 5 times.

    if (GUI.Button(Rect(10,10,50,50),btnTexture))        Debug.Log("Clicked the button with an image");    if (GUI.Button(Rect(10,70,50,30),"Click"))        Debug.Log("Clicked the button with text");

:slight_smile: Ofcourse i forgot to add on my first post… so they need to be array. And Javascript.

In an array how?

Why do you need them in an array?

If it is just like push button 1 arr[0] = false, etc just put the part of the array in the if argument.

Why don’t you check out the solution I linked and convert it to UnityScript?

Because im bad with C# :slight_smile: