I’m a Unity noob and just know enough js to make me dangerous, so go easy on me.
I have a series of GUI “panels” generated through script that the user can pick and choose from. When a user closes one panel I want another to pop up. Right now I can generate the first panel and have it close when a button is clicked by destroying the script. I’m guessing this is not the best way to do it, as now I need to find a way to attach a new script in my if statement for the next panel to pop up.
I’ve seen references to enabling/disabling GUI.Layer but can’t find any references or tutorials. Also have read I could attach different elements to different cameras and switch between the cameras, but again, no tutes.
Here is my current script, attached to the camera, and called floorplanPanel (thus destroying itself onMouseUp.
var customButton : GUIStyle;
var customLabel : GUIStyle;
var floorplanbox : GUIStyle;
var navbox : GUIStyle;
var iconlabel : GUIStyle;
var iconplumbing : GUIStyle;
var iconfurniture : GUIStyle;
var iconText : GUIStyle;
function OnGUI () {
if (GUI.Button (Rect (10,10,20,20), "", customButton) GetComponent(floorplanPanel))
{
Destroy(GetComponent(floorplanPanel));
}
GUI.Label (Rect (35, 12, 100, 20), "FLOORPLAN", customLabel);
GUI.Box (Rect (10, 36, 287, 287), "", floorplanbox);
GUI.Box (Rect (10, 330, 145, 96), "", navbox);
GUI.Button (Rect (165, 332, 21, 21), "", iconlabel);
GUI.Button (Rect (165, 363, 21, 21), "", iconplumbing);
GUI.Button (Rect (165, 394, 21, 21), "", iconfurniture);
GUI.Label (Rect (190, 335, 100, 20), "LABELS OFF", iconText);
GUI.Label (Rect (190, 366, 100, 20), "PLUMBING OFF", iconText);
GUI.Label (Rect (190, 397, 100, 20), "FURNITURE OFF", iconText);
}