-
Notifications
You must be signed in to change notification settings - Fork 25
Working with popups
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 "PopUp".
- In the inspector for the
OGPopUp
object, locate the "options" array. - Each option is simply a string to display.
- Say we want to generate the content of an
OGPopUp
via scripting:
// UnityScript
public var popup : OGPopUp;
function Start () {
// Populate the options array
popup.SetOptions ( [ "option1", "option2", "option3" ] );
// Make sure the message handler is this object
pop.target = this.gameObject;
// Set the function name
pop.message = "OnPopupClick";
// Let's pass the selected option as an argument
pop.passSelectedOption = true;
}
public function OnPopupClick ( selectedOption : String ) {
Debug.Log ( "You picked the '" + selectedOption + "' option!" );
}
// C#
public OGPopUp popup;
void Start () {
// Populate the options array
popup.SetOptions ( { "option1", "option2", "option3" } );
// Make sure the message handler is this object
pop.target = this.gameObject;
// Set the function name
pop.message = "OnPopupClick";
// Let's pass the selected option as an argument
pop.passSelectedOption = true;
}
public void OnPopupClick ( string selectedOption ) {
Debug.Log ( "You picked the '" + selectedOption + "' option!" );
}