GUI Help

Hello
i need help with a GUI system that goes like this

The the screen is a button.
Press Button, a GUI box appears, showing a list: Catagory 1, Catagory 2… and so on.
When you press Catagory 1 another GUI box appears and shows a list: model 1, model 2, model 3… and so on
Same with Catagory 2, Catagory 3…

Thanks

this can be done with a chain of bools :smile:

for example:

var Button1 = true;
var B2 = false;
var B3 = false;

function OnGUI () {
if(GUI.Button(Rect(10,10,40,40), "Open") {
    B2 = true;
    }
if(B2) {
     if(GUI.Button(Rect(40,40,40,40), "open Another") {
   B3 = true;
   }
if(B3) {
GUI.Box(Rect(100,100,100,100), "random Box") {
}
}
    }
}

i wrote this in reply box, so may need tweaking.
also where the numbers are(coordinates) ie (100,100,100,100) you can use variables instead to place these:
you can also use a string to name the button

var But = "button name";
var B1 = 20;
var B2 = 20;
var B3 = 20;
var B4 = 20;

if(GUI.Button(Rect(B1, B2,B3,B4), But)) {
print("hi");
}

This will allow you to edit through the inspector whilst playing to place the buttons in correct places!

You could also make use of an enum.

Bare C# example

public enum ScreenTypes
{
	Screen1,
	Screen2,
	Screen3
}

public ScreenTypes currentScreen = ScreenTypes.Screen1;
	
void OnGUI()
{
	if(GUILayout.Button("Screen1"))
	{
		currentScreen = ScreenTypes.Screen2;
	}
	
	if(currentScreen == ScreenTypes.Screen1)
	{
		// Gui stuff
	}
}