-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
NGUI for Unity
By :
The Notify parameter in the Inspector window we used in previous chapters to call methods on a precise event is usually enough for sending messages. However, you may need to send a message to another GameObject and maybe to its children too.
That's where the UIButton Message component comes in handy. We will use this to make our MainMenu GameObject scale down before the game actually quits:
Select our Exit GameObject and perform the following steps:
Attach a Button Message component to it by navigating to Component | NGUI | Interaction.
Drag our Container GameObject from MainMenu into its Target field.
Type in CloseMenu in the Function Name parameter.
Select our Container GameObject in MainMenu and open its attached AppearFromAbove.cs script.
In this script, add a simple CloseMenu() method containing the following lines:
void CloseMenu()
{
//Tween the menu's scale to zero
TweenScale.Begin(this.gameObject, 0.5f, Vector3.zero);
}Now we need to delay the execution of the Application...
Change the font size
Change margin width
Change background colour