Ui options within boxes

Hey guys, this is my first time posting so please forgive me for any unauthorized etiquette.

I am making a Main menu and have tabs for options.

If I Press the settings tab, I have a small window opening on the right side of the screen and within that i have 3 buttons for controls, video and audio.

For example, Within my control options i have two boxes named Keyboard and Mouse

how do i put their respective options like changing controls inside those boxes within the window.

Flow

          *click*

|||Play|||Chat|||Settings|||

             *click*

          |||Controls|||Video|||Audio|||
         
          |||Keyboard|||Mouse|||

             Options    Options

3 Answers

3

As you are new, I guess you are not aware of those pages:

http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html

They contain most of the starting needs.

Before posting anything, google "my problem unity.

Ex: gui unity

and in 95% of cases you will find a detailed answer either in the scripting pages of unity or in the Unity forum.

Thanks for your reply but even though I’m new to this site, I’m not new to the internet. I googled and read through the ui documentation on the website and can’t find any solutions tailored to my needs hence I’m using this as a last resort.

I’m new to Unity myself and had this question as well…hope this can be of help.

Are you using a GUI.Window / GUILayout.Window? I found their examples to be really helpful. If so, does your window functon (“WindowFunction” or “DoMyWindow” in the docs’ example) have any GUI controls? That is where you would put them, just as you would any other controls in OnGUI. If you already have the logic to render the window after you’ve clicked the Settings button, then you probably will have similar code to show the controls options after you’ve clicked the controls button, only it will be in the window function not in OnGUI.

e.g.:

var showControls : boolean = false;

function DoMyWindow(windowID : int){
      if (GUILayout.Button ("Controls")){
           showControls = true;
      }
          // ...more code for "Video"/"Audio" buttons...
      if(showControls){
          if(GUILayout.Button("Keyboard")){
             //keyboard stuff
          }
          if(GUILayout.Button("Mouse")){
             //mouse stuff
          }
       }
}

If you’re not using Windows, just new Boxes/Areas in OnGUI, then it would be the same but in OnGUI… I think the biggest leap for me in learning Unity GUI was to realize that OnGUI is called constantly [from the docs; “several times per frame”], so you will need to handle all GUI states in OnGUI, but ensure that you have your GUI states set prooperly on GUI events.