Book Image

NGUI for Unity

By : Charles Bernardoff
Book Image

NGUI for Unity

By: Charles Bernardoff

Overview of this book

Table of Contents (14 chapters)

Error notification

We want the user to enter a nickname in the input field and select a power before he or she can launch the game.

Right now, the user can launch the game regardless of the input and selected power value. Let's correct this by preventing the game's launch and notifying the user, as shown in the following screenshot:

We will use a TweenScale through code that will gradually scale up the notification from {0, 0, 0} to {1, 1, 1} by following these steps:

  1. Select our Tooltip GameObject in the Hierarchy window.

  2. Duplicate it with Ctrl + D.

  3. Rename this new duplicate as Notification and perform the following steps:

    1. Set its Depth parameter in UIPanel to 5.

    2. Remove its UITooltip component.

    3. Set its Transform position to {0, -355, 0}.

  4. Select our Label GameObject in Notification and perform the following steps:

    1. Change its text to This is a Notification.

    2. Set the Overflow parameter to Shrink Content.

    3. Set its Pivot parameter to Center (middle button + middle button).

    4. Set its Dimensions to 550 x 80.

    5. Reset...