O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unity 3D UI Essentials

Book Description

Leverage the power of the new and improved UI system for Unity to enhance your games and apps

In Detail

Unity is a powerful cross-platform development engine that provides rich framework to create 2D and 3D apps or games. Through Unity, users are able take master the complexities of game development with ease, including animations, physics, renderings, shaders, scripting and now, Unity have released a new and advanced system to cope with the UI demands for modern applications and games.

Unity 3D UI Essentials is a complete walk-through of the new UI system in Unity V4 and beyond (including Unity 5). This fast-paced practical tutorial provides you with in depth details of the new UI controls and layouts that can be used to create stunning and multiresolution UI.

Venture forth into the highly componentized and advanced UI system, covering new features such as responsive designs and layouts. Also you get to deep-dive into the scripting side of the UI system as Unity has made the entire framework open source, giving free access to the source code of the new UI system to all developers.

So get ready for a wild ride into the new Unity UI system and set your course for awesome!

What You Will Learn

  • Get to grips with the Legacy Unity GUI fundamentals to better understand the path forward
  • Explore the tools Unity introduced with the new UI system such as the Rect Transform layout tool
  • Unwrap the new base Unity UI controls and what makes them tick
  • Work with the layout features and take control in a multiresolution world
  • Build stunning UI within the 3D as well as the traditional 2D world
  • Understand the new Unity Event System and how it fits in to the new UI system and beyond

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Unity 3D UI Essentials
    1. Table of Contents
    2. Unity 3D UI Essentials
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Looking Back, Looking Forward
      1. State of play
        1. GUI controls
          1. The Label control
          2. Texture drawing
          3. The Button control
          4. The Text control
          5. The Box control
          6. The Toggle/checkbox control
          7. Toolbar panels
            1. The Toolbar control
            2. The SelectionGrid control
          8. The Slider/Scrollbar controls
            1. Slider control code
            2. Scrollbar control code
          9. The ScrollView control
          10. Rich Text Formatting
            1. <b></b>
            2. <i></i>
            3. <size></size>
            4. <color></color>
        2. Common control features
          1. Grouping controls
          2. Naming controls
          3. Getting in focus
            1. The logon example
          4. Tooltips
          5. The Window control
        3. GUI styles and skins
        4. GUI events and properties
        5. Layout controls
          1. BeginArea
          2. Horizontal and Vertical layout groups
      2. The Asset Store
      3. Enter Thunderdome
        1. New layouts
          1. Rect Transform
          2. The Canvas
          3. Groups
            1. Horizontal Layout Group
            2. Vertical Layout Group
            3. Grid Layout Group
            4. Toggle Group
            5. Canvas Group
          4. Masking
        2. New controls
        3. New UnityEvent system
        4. Control extensibility
        5. Animation
        6. Even the Asset Store has you covered
          1. TextMeshPro ($65)
          2. GUI Generator ($40)
          3. MenuPage ($10)
      4. Summary
    9. 2. Building Layouts
      1. The Rect Transforms
        1. The Rect Tool
        2. The Rect Transform component
          1. Scaling the Rect Transform
        3. The Canvas
          1. The Canvas Renderer
          2. Canvas Groups
      2. Automatic layouts and options
        1. Horizontal Layout Group
        2. Vertical Layout Group
        3. Grid Layout Group
        4. Layout options
          1. Layout Element
          2. Content Size Fitter
          3. Aspect Ratio Fitter
          4. Scroll Rect
          5. Masks
      3. Resolution and scaling
        1. Constant Pixel Size
        2. Scale with Screen Size
        3. Constant Physical Size
      4. The UnityEvent system
        1. Raycasting
        2. Input modules
        3. Input events
        4. Event Triggers
      5. Summary
    10. 3. Control, Control, You Must Learn Control
      1. Overview
        1. A word on code
        2. Setting up the project
        3. A warning on the built-in images
      2. Dealing with text
        1. A simple FPS control
        2. Adding interaction with input
        3. Shadows and effects
      3. Bring on the images
        1. Image types
          1. Simple Images
          2. Sliced Images
          3. Tiled Images
          4. Filled Images
        2. Adding animation to the mix
        3. A word on RawImage
      4. Don't push this button
        1. What makes it Selectable?
        2. An event occurred, what do I do?
        3. The ultimate awesome menu
      5. Which direction to travel?
        1. Grouping toggles
        2. Dynamic event properties
      6. Sliding opportunities
      7. Ancient scrolls
        1. Scrolling, Rect'ing, and Masking, oh my
      8. Navigation
      9. A word on shaders
      10. Summary
    11. 4. Anchors Away
      1. Dropping Anchor
      2. Put a nail in it, and trim the sails
      3. Stretch it, bend it
      4. Scaling and resolution
        1. Working with the constant default
        2. Scaling to my view
        3. Getting physical
        4. Which to choose?
      5. Summary
    12. 5. Screen Space, World Space, and the Camera
      1. The Canvas and Cameras
        1. Screen Space and World Space
        2. Render cameras
        3. Event Cameras
      2. Getting some perspective
      3. Setting up for the big game
        1. Some prerequisites
        2. Next up, some Sprite 2D work
      4. A Screen Space – Camera health bar
        1. What's in a Canvas?
        2. Am I dead yet?
        3. Reaching in
        4. It's all gone a bit flat
      5. Going deep
        1. Hang your Canvas wherever you like
        2. The showcase
        3. Build your UI and place it in the scene
        4. Troubles with scale
        5. A better way
        6. A final word on Event Cameras
      6. Summary
    13. 6. Working with the UI Source
      1. Unravelling the Event System
        1. The Event System loop
        2. Controlling state
        3. Raycast Marshalling
      2. Working with events
        1. Using a parameter
        2. Built-in event interfaces
        3. Executing events
        4. Building your own handlers or custom events
          1. A custom event Data Structure
          2. A custom event Interface
          3. A custom event static container
          4. Processing a custom event
        5. The Roll a Ball Derby
          1. The Droid script
          2. The Alarm plates
          3. Who watches the watchers?
        6. Summing up the Event System
      3. Examples, examples, and even more examples
      4. Getting access to the source
        1. The repository
        2. Getting forked
        3. Downloading the code
        4. Keeping up to date
        5. What is in the solution?
        6. Adding your own version of UI to your project
        7. Extra credit, push it back to Unity
      5. Summary
    14. A. The 3D Scene Sample
      1. Setting up for the big game
        1. The initial 3D scene
    15. Index