Book Image

Learning NGUI for Unity

By : Charles Bernardoff (EURO)
Book Image

Learning NGUI for Unity

By: Charles Bernardoff (EURO)

Overview of this book

Table of Contents (17 chapters)
Learning NGUI for Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The flexible UI


The flexible UI conserves your UI pixel-perfect using the Flexible scaling style. It will make sure that all your widgets are displayed at their original pixel size. That's good to display your UI as crisp as it can be.

It is recommended that you use this mode for PC games, using anchors intelligently to make sure all the widgets are positioned depending on the screen's bounds.

If you create a 256 x 256 pixels button sprite, it will take a large amount of space on 800 x 480 screens and be very small on a 1920 x 1080 screen. We'll also have the same issue with fonts: a 50-pixel size font will be displayed at a reasonable size on small devices, but will be tiny and unreadable on high resolution tablet screens.

That's where the UIRoot component's Minimum Height and Maximum Height parameters become useful; they define from which screen height the UI will be scaled down or up.

Let's create a new scene to try the flexible UI and other examples in this chapter:

  1. Create a new scene by...