Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering UI Development with Unity

You're reading from   Mastering UI Development with Unity Develop engaging and immersive user interfaces with Unity

Arrow left icon
Product type Paperback
Published in Jun 2024
Publisher Packt
ISBN-13 9781803235394
Length 638 pages
Edition 2nd Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Dr. Ashley Godbold Dr. Ashley Godbold
Author Profile Icon Dr. Ashley Godbold
Dr. Ashley Godbold
Arrow right icon
View More author details
Toc

Table of Contents (28) Chapters Close

Preface 1. Part 1: Designing User Interfaces
2. Chapter 1: Designing User Interfaces FREE CHAPTER 3. Chapter 2: Designing Mobile User Interfaces 4. Chapter 3: Designing VR, MR, and AR UI 5. Chapter 4: Universal Design and Accessibility for UI 6. Chapter 5: User Interface and Input Systems in Unity 7. Part 2: Unity UI Basics
8. Chapter 6: Canvases, Panels, and Basic Layouts 9. Chapter 7: Exploring Automatic Layouts 10. Chapter 8: The Event System and Programming for UI 11. Part 3: The Interactable Unity UI Components
12. Chapter 9: The UI Button Component 13. Chapter 10: UI Text and TextMeshPro 14. Chapter 11: UI Images and Effects 15. Chapter 12: Using Masks, Scrollbars, and Scroll Views 16. Chapter 13: Other Interactable UI Components 17. Part 4: Unity UI Advanced Topics
18. Chapter 14: Animating UI Elements 19. Chapter 15: Particles in the UI 20. Chapter 16: Utilizing World Space UI 21. Chapter 17: Optimizing Unity UI 22. Part 5: Other UI and Input Systems
23. Chapter 18: Getting Started with UI Toolkit 24. Chapter 19: Working with IMGUI 25. Chapter 20: The New Input System 26. Index 27. Other Books You May Enjoy

Laying out the UI elements

When laying out the UI for your game, I strongly recommend checking other games of the same genre and seeing how they implemented their UI. Play the game and see whether it feels good to you.

If you are unsure of how to lay out your game’s UI, I recommend dividing the game’s screen into a guttered grid, like the one shown in the following diagram, and placing items within the non-guttered areas:

Figure 1.2: A guttered grid

Figure 1.2: A guttered grid

You can use as many grids as you want, but laying out the items with reference to the grid will help ensure that the UI is arranged in a balanced way.

In most cases, the HUD items should remain at the outer edges of the grid. Any UI that displays in the center grids will restrict the player view. So, this area is good for pop-up windows that pause the gameplay.

The device your game will be played on is important when determining the layout. If your game is designed for a mobile device and has a lot of buttons the player will interact with, the buttons are generally best suited for the bottom or side portions of the screen. This is due to the way players hold their phones and the top-center part of the screen is the most difficult area to reach with their thumb. Additionally, reaching for this area will cause them to block the majority of the game view with their hand. We will discuss designing UI for mobile more thoroughly in Chapter 2.

You’ll note that when you play computer games, they tend to have much smaller and more cluttered UI than mobile and console games. This is due to visibility and interaction. Clicking on small objects with a mouse is significantly easier than tapping them with a finger or selecting them with the D-pad. Also, the screen resolution is much bigger, which allows for more space to be taken up by the UI.

When trying to determine the size and relative location of UI items, you can reference Fitts’ Law. Fitts’ Law can mathematically calculate how long it will take a user to navigate to a UI item based on its size and distance away from the user’s starting position. I won’t go over the math here (despite the math teacher in me desperately wanting to), but the lessons that can be garnered from Fitts’ Law are as follows:

  • Don’t make interactable UI small and far apart
  • Make the most important interactable items the largest and near each other

Next, we’ll look at resolution and aspect ratio.

You have been reading a chapter from
Mastering UI Development with Unity - Second Edition
Published in: Jun 2024
Publisher: Packt
ISBN-13: 9781803235394
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image