Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Need help figuring out GUILayout

Discussion in 'Scripting' started by Zexanima, Jun 11, 2014.

  1. Zexanima

    Zexanima

    Joined:
    Jan 2, 2014
    Posts:
    33
    So I'm trying to make a GUI with GUILayout because there is not as much fuss to get it to scale properly. However, I don't understand the GUILayout setup too well apparently and can't get the layout I want. This is the layout I'm trying to get.



    This is what I have



    And here is my code.

    Code (CSharp):
    1. void MenuSingle(){
    2.         GUI.skin = customSkin;
    3.         GUILayout.BeginArea (new Rect(0, 0, Screen.width, Screen.height));
    4.  
    5.         GUILayout.BeginVertical ();
    6.         GUILayout.BeginHorizontal ();
    7.  
    8.         if(GUILayout.Button("Back")){
    9.             MenuOptions = MenOpts.Main;
    10.         }
    11.         GUILayout.Label ("Single Player");
    12.         if (GUILayout.Button ("Start")) {
    13.                
    14.         }
    15.  
    16.         GUILayout.EndHorizontal ();
    17.  
    18.         GUILayout.BeginHorizontal ();
    19.         if(GUILayout.Button("Drop1")){
    20.            
    21.         }
    22.         if(GUILayout.Button("Drop2")){
    23.            
    24.         }
    25.         if(GUILayout.Button("Drop3")){
    26.            
    27.         }
    28.         GUILayout.EndHorizontal ();
    29.  
    30.  
    31.         GUILayout.BeginVertical ();
    32.         GUILayout.Box ("", GUILayout.ExpandWidth (true), GUILayout.ExpandHeight (true));
    33.         GUILayout.Box ("", GUILayout.ExpandWidth (true), GUILayout.ExpandHeight (true));
    34.         GUILayout.EndVertical ();
    35.         GUILayout.Box ("", GUILayout.ExpandWidth (true), GUILayout.ExpandHeight (true));
    36.  
    37.  
    38.         GUILayout.EndVertical ();
    39.  
    40.  
    41.  
    42.  
    43.  
    44.         GUILayout.EndArea ();
    45.     }
     
  2. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
    I would give NGUI a try. Much easier and cheaper on the resources.
     
  3. Zexanima

    Zexanima

    Joined:
    Jan 2, 2014
    Posts:
    33
    I'll give it a look.