Learning NGUI for Unity
上QQ阅读APP看书,第一时间看更新

The Prefab Toolbar

We have added our first Background control prefab by dragging it from the Project view to our Hierarchy view. Well, NGUI comes with a Prefab Toolbar that helps us organize them.

In order to show the toolbar, navigate to NGUI | Open | Prefab Toolbar.

A new window like this appears:

The Prefab Toolbar

With this window, you can simply drag-and-drop one of the prefabs directly into the Scene or Hierarchy view!

You can organize your prefabs in up to five tabs. Use the buttons at the top of the window (1) to switch between different tabs.

If you want to add a prefab to the current tab, simply drag-and-drop your prefab from the Project or Hierarchy view inside the toolbar—or click on the Add (2) button.

Three different display modes (3) are available:

  • Compact Mode: This displays small icons
  • Icon Mode: This displays large icons. This is the mode set by default
  • Detailed Mode: This displays a large icon along with the prefab name

Please set Display Mode (3) to Detailed Mode. It will be easier for us.

Note

If you have a Unity Free license, render textures are not supported: all your icons are white. Even then, the Prefab Toolbar still comes in handy.

Now that we have seen how the Prefab Toolbar works, it's time to create buttons.