How do I fix my GUILayout.Button

Hi im trying to make a drop down list (kind of) by an area being created when I click a button. Right now, both the button and the drop down area an present on the screen and I need to know how to make it so it only appears when I click the button.

`

if(GUI.Button(new Rect(Screen.width/2 -358, 170, 150, 20), selectedItem))

    { 
         editing = true;
    }
GUILayout.BeginArea(new Rect(Screen.width/2 - 358, 190, 150, 60), ":, "Box");

foreach(MapSetting map in MultiplayerManager.instance.MapList)
{
     if(GUILayout.Button(map.MapName))
     {
           NavigateTo("Host");
           MultiplayerManager.instance.CurrentMap = map;
     }
}
GUILayout.EndArea();

If I understand what you mean, you want the foreach() statement block to be toggled by hitting the button, correct? If so, this is what you’re looking for. Use the top button as a toggle, then when it is pressed toggle the value of “editing.” Use the value of editing to determine if you should draw the rest of the controls.

if(GUI.Button(new Rect(Screen.width/2 -358, 170, 150, 20), selectedItem))
    { 
         editing = !editing;
    }

if(editing)
{
   GUILayout.BeginArea(new Rect(Screen.width/2 - 358, 190, 150, 60), ":, "Box");

   foreach(MapSetting map in MultiplayerManager.instance.MapList)
   {
     if(GUILayout.Button(map.MapName))
     {
           NavigateTo("Host");
           MultiplayerManager.instance.CurrentMap = map;
     }
   }
   GUILayout.EndArea();
}

Yes thanks a ton man!