Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning NGUI for Unity
  • Table Of Contents Toc
Learning NGUI for Unity

Learning NGUI for Unity

By : Charles Bernardoff (EURO)
4.7 (6)
close
close
Learning NGUI for Unity

Learning NGUI for Unity

4.7 (6)
By: Charles Bernardoff (EURO)

Overview of this book

Project teams rarely forget to work on the technology, but they often forget to work with the people, and no matter how amazing your new technology is, it’s useless unless people use it efficiently.
Table of Contents (12 chapters)
close
close
11
Index

Event delegates


Many NGUI components broadcast events, for which you can set an event delegate—also known as a callback method—executed when the event is triggered. We did it through the Inspector view by assigning the Notify and Method fields when buttons were clicked.

For any type of tween, you can set a specific event delegate for when the tween is finished. We'll see how to do this through code. Before we continue, we must create our callback first. Let's create a callback that loads a new scene.

The callback

Open our MenuManager.cs script, and add this static LoadGameScene() callback method:

public static void LoadGameScene()
{
//Load the Game scene now
Application.LoadLevel("Game");
}

Save the script. The preceding code requests to load the Game scene. To ensure Unity finds our scenes at runtime, we'll need to create the Game scene and add both Menu and Game scenes to the build settings:

  1. Navigate to File | Build Settings.

  2. Click on the Add Current button (don't close the window now).

  3. In Unity...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning NGUI for Unity
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon