Foldout Hierarchy for In-Game Menu

I am creating a menu where you can select a camera from 55 individual fixed points throughout the game world. These 55 cameras are split into 4 categories, and I was wondering whether anyone knew how to recreate a “foldout” style list, where each of the 4 categories can be expanded or retracted, so that the whole list of 55 isn’t always on screen? Maybe similar to something in the Hierarchy or Project windows?

I can only seem to find GUIEditor scripting. Any help hugely appreciated!

Hello,

AFAIK there are not such properties in the GUI to make a “foldout” style list.

BUT, you can create one manually moving the positions along time :slight_smile:

Right! Have developed a solution. I have styled buttons as labels, making them look like a simple text string. The drop down is controlled by a boolean LPIsExpanded. When it is true, the plus/minus string changes to minus and vice versa. Seems to work pretty well, just need to build in a scroll bar if the length is longer than 400, and it should work a treat. Any thoughts?

var LPIsExpanded : boolean = false;
var LP_PlusOrMinus : String;
var Plus : String = "[ + ]   ";
var Minus : String = "[ - ]   ";

var CameraBoxHeight : float = 400;
var CameraBoxWidth : float = 250;

function Awake(){

LP_PlusOrMinus = Minus;
}
function OnGUI () {

GUI.Box(Rect ((Screen.width/2)-(CameraBoxWidth/2)-10, (Screen.height/2)-(CameraBoxHeight/2)-10,CameraBoxWidth+20,CameraBoxHeight+50), "");
GUILayout.BeginArea (Rect ((Screen.width/2)-(CameraBoxWidth/2), (Screen.height/2)-(CameraBoxHeight/2),CameraBoxWidth,CameraBoxHeight));

LPIsExpanded = GUILayout.Toggle(LPIsExpanded,LP_PlusOrMinus + "  Camera drop down menu", "label");
	if (LPIsExpanded==false){
	LP_PlusOrMinus = Plus;
	}
	if (LPIsExpanded==true){
	LP_PlusOrMinus = Minus;
		if (GUILayout.Button("   - button", "label")){
performfunction();
		}
		if (GUILayout.Button("   - button", "label")){
performfunction();
		}
		if (GUILayout.Button("   - button", "label")){
performfunction();
		}
}