NGUI for Unity

NGUI for Unity
eBook: $20.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $55.98    Print cover: $34.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Acquire complete knowledge of every component of NGUI
  • Design and customize a fully functional main menu aided by step by step instructions
  • Create an exciting 2D sci-fi game

Book Details

Language : English
Paperback : 182 pages [ 235mm x 191mm ]
Release Date : January 2014
ISBN : 1783558660
ISBN 13 : 9781783558667
Author(s) : Charles Bernardoff
Topics and Technologies : All Books, Game Development, Other

Table of Contents

Chapter 1: Getting Started with NGUI
Chapter 2: Creating Widgets
Chapter 3: Enhancing your UI
Chapter 4: C# with NGUI
Chapter 5: Building a Scrollable Viewport
Chapter 6: Atlas and Font Customization
Chapter 7: Creating a Game with NGUI
  • Chapter 1: Getting Started with NGUI
    • What is NGUI?
      • UnityGUI versus NGUI
      • Atlases
      • Events
      • Localization
      • Shaders
    • Importing NGUI
    • Creating your UI
      • UI Wizard
        • Window
        • Parameters
      • Separate UI Layer
    • Your UI structure
      • UI Root (2D)
        • Parameters
      • Camera
        • Parameters
      • Anchor
        • Parameters
      • Panel
        • Parameters
    • Summary
  • Chapter 2: Creating Widgets
    • Creating our first widget
      • Widget Wizard
      • Selecting an atlas
      • Creating a widget from a template
      • Transforming widgets
        • Moving widgets
        • Rotating widgets
        • Scaling widgets
      • Common widget parameters
    • Sprites
      • Sliced sprites
      • Tiled sprites
      • Filled sprites
    • Labels
      • Parameters
      • Creating the title bar
    • Buttons
      • Parameters
      • The play and exit buttons
    • Text input
      • Parameters
      • Creating a nickname box
    • Slider
      • Parameters
      • Creating a volume slider
    • Toggle
      • Parameters
      • Creating a sound toggle
    • Popup list
      • Parameters
      • Creating a difficulty selector
    • Summary
  • Chapter 3: Enhancing your UI
    • NGUI components
    • The draggable panel
      • Parameters
      • Dragging the MainMenu
    • The drag-and-drop system
      • Powers selection
        • Draggable items container
        • Draggable items
        • The drop surface
        • Prefab instantiated on drop
        • Handling an invalid drop
        • Replacing the current item
        • Removing the current item
    • Animations with NGUI
      • Smooth powers apparition
      • Clipping to hide options
    • Scrollable text
    • Localization system
      • Localization files
      • Localization component
      • Language selection box
      • Localizing a Label
    • Summary
  • Chapter 4: C# with NGUI
    • Events methods
      • Creating a tool tip
        • The tool tip reference
        • Showing the tool tip
    • Tween methods
      • Main menu apparition
        • Simple Tween
        • Smooth Tween
    • Using keys for navigation
    • Error notification
    • Saving the nickname
    • Sending messages
    • Forwarding an event
    • Summary
  • Chapter 5: Building a Scrollable Viewport
    • Preparing the Game scene
    • The scrollable viewport
      • Draggable background
      • Linking scroll bars
      • Keyboard scrolling
    • Creating draggable barriers
      • The BarrierObject prefab
      • Dropping a barrier on Viewport
    • Creating an ActiveBarrier prefab
      • The ActiveBarrier prefab
      • Instantiating the ActiveBarrier prefab
      • Barrier's building process
      • Forwarding events to viewport
    • BarrierObject cooldown
      • Cooldown implementation
      • BarrierObject smooth apparition
    • The barrier availability tool tip
    • Summary
  • Chapter 6: Atlas and Font Customization
    • The Atlas prefab
    • Creating a new Atlas
    • Adding sprites to Atlas
      • Simple sprites
        • Adding sprites to Atlas
        • Available powers icons
        • Selected powers icons
      • Sliced sprites
        • Adding a sprite to Atlas
        • Configuring a sliced sprite
        • The Main Menu window
      • Tiled sprites
    • Adding a font
      • Exporting a font using BMFont
      • Creating a font in Unity
      • Assigning a new font to Label
    • Customizing the MainMenu
    • Summary
  • Chapter 7: Creating a Game with NGUI
    • Enemy spawning
      • Creating the enemies container
      • Creating the Enemy prefab
      • Creating the enemy spawn controller
      • Forwarding events to viewport
    • Handling enemy collisions
      • Collisions with active barriers
      • Colliding with the bottom of the screen
        • Healthbar
        • The EndOfScreen widget
    • Creating self-destruct code
      • The hacking slider
      • Self-destruct code
      • Assigning code to an enemy
      • The hacking process
      • Handling player input
    • Summary

Charles Bernardoff

Charles Bernardoff has a bachelor's degree in Game Design and Level Design delivered by ISART Digital, a video games school located in Paris, France.

With four years of experience as game designer, level designer, and C# scripterat Cyanide Studio, Playsoft, and Airbus, Charles has worked on the PC versions of Blood Bowl, Dungeonbowl, and Confrontation. He has also worked on Unity and Flash mobile games, such as Space Run 3D, Oggy, and Psycho Gnomes.

He now works as Game Designer and Unity developer on PC and mobile Serious Games at Airbus.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

NGUI for Unity +    Bootstrap Site Blueprints =
50% Off
the second eBook
Price for both: $33.45

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Download and import NGUI
  • Construct a basic user interface: buttons, sprites, text inputs, lists, sliders, and more
  • Enhance your UI using clipping, draggable panels, content alignment, animations, and localization
  • Use C# with NGUI to save options, implement volume modification, launch animations, and change variables
  • Build a scrollable viewport with a drag-and-drop system
  • Create tooltips and notifications
  • Add your sprites and fonts to customize your main menu
  • Move elements through code and handle collisions to create a game

In Detail

NGUI is an effective plugin for Unity that gives you the power to create beautiful and complex user interfaces while reducing performance costs. It is a powerful UI system and event notification framework for Unity (both Pro and Free) written in C# featuring clean code and a simple, minimalistic approach to everything. You can create a main menu for your game and add sliders, animations, checkboxes, and popup lists, as well as localize your text.

This is an example-oriented, step-by-step, practical tutorial that will guide you through creating a fully functional main menu along with a 2D game. You will acquire the knowledge to create user interfaces for your existing and future PC or mobile games developed with Unity 3D. The book will start by teaching you the basic functions of the tools and how to create a basic UI. Later in the book, you will also learn how to create a much more complex UI.

This book will start by getting you acquainted with NGUI’s workflow and will then gradually take you through building a complex menu and creating a 2D game.

To achieve this, you will create and configure text labels, sliders, and checkboxes along with drag-and-drop systems. You will be exposed to advanced topics like C# with NGUI, and you will also learn how to build a scrollable viewport. By the end of this book, you will have acquired all the knowledge you need to create UIs with the help of practical steps supported by screenshots.


An easy-to-follow, step-by-step tutorial focusing on practical situations and manipulations, guiding you to create a concrete Graphical User Interface and a simple 2D game.

Who this book is for

If you are a Unity 3D developer looking forward to learn NGUI for Unity, then this book is for you. Prior knowlege of C# scripting is expected. Additional knowledge of Unity 3D Editor, GameObject and creating/adding scripts to GameObject would be beneficial; however, no prior knowledge of NGUI is required.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software