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)

Customizing the MainMenu

The blue background of our menu's main camera is not very nice. Let's set a black background for the camera, and add our space tiling sprite to make this better:

  1. Select our MainMenu GameObject from Anchor, and create a new sprite by navigating to NGUI | Create | Sprite, or press Alt + Shift + S.

  2. Select the new Sprite GameObject from MainMenu and perform the following steps:

    1. Rename it as Space.

    2. Set its Atlas type to our Game atlas.

    3. Set its Sprite to our Space tiling sprite.

    4. Set its Sprite Type parameter to Tiled.

  3. Attach a Stretch component to it by navigating to Component | NGUI | UI:

  4. Set its Style parameter to Both.

You may notice that we have ugly lines between each repetition of the Space sprite. That is simply because there is a 1-pixel-wide border on the sprite. We can easily correct this by reducing the sprite's border value of 1 pixel.

Select our Space GameObject from MainMenu, and click on the Edit button next to the Sprite field, as shown in the following screenshot...