-
Notifications
You must be signed in to change notification settings - Fork 25
Working with tabs
Jeppe Zapp edited this page May 13, 2014
·
4 revisions
- If you haven't set up an
OGRoot
andOGPage
yet, do it via the OpenGUI menu. - With the same menu under "Widgets", click "Tabs".
- In the inspector for the
OGTabs
object, locate the "tabs" array. - All tabs have a "title" and "content" parameter. The latter is a
GameObject
that will be toggled on/off by the respective tab. - That's it for setting up tabs manually. To do it via scripting:
// UnityScript
public var tabs : OGTabs;
public var content1 : GameObject;
public var content2 : GameObject;
public var content3 : GameObject;
public function InitTabs () {
// Make sure there are no tabs already
tabs.ClearTabs ();
// Add a new tab and switch to it immediately
tabs.AddTab ( "Tab 1", content1, true );
// Add 2 more tabs, but don't switch to them
tabs.AddTab ( "Tab 2", content2, false );
tabs.AddTab ( "Tab 3", content3, false );
// On second thought, let's switch to tab number 2
tabs.SetActiveTab ( 1 );
}
// C#
public OGTabs tabs;
public GameObject content1;
public GameObject content2;
public GameObject content3;
public void InitTabs () {
// Make sure there are no tabs already
tabs.ClearTabs ();
// Add a new tab and switch to it immediately
tabs.AddTab ( "Tab 1", content1, true );
// Add 2 more tabs, but don't switch to them
tabs.AddTab ( "Tab 2", content2, false );
tabs.AddTab ( "Tab 3", content3, false );
// On second thought, let's switch to tab number 2
tabs.SetActiveTab ( 1 );
}