Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unity Cookbook

You're reading from   Unity Cookbook Over 160 recipes to craft your own masterpiece in Unity 2023

Arrow left icon
Product type Paperback
Published in Nov 2023
Publisher Packt
ISBN-13 9781805123026
Length 780 pages
Edition 5th Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Sinéad Murphy Sinéad Murphy
Author Profile Icon Sinéad Murphy
Sinéad Murphy
Matt Smith Matt Smith
Author Profile Icon Matt Smith
Matt Smith
Shaun Ferns Shaun Ferns
Author Profile Icon Shaun Ferns
Shaun Ferns
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Displaying Data with Core UI Elements 2. Responding to User Events for Interactive UIs FREE CHAPTER 3. Inventory and Advanced UIs 4. Playing and Manipulating Sounds 5. Textures, Materials, and 3D Objects 6. Creating 3D Environments with Terrains 7. Creating 3D Geometry with ProBuilder 8. 2D Animation and Physics 9. Animated Characters 10. Saving and Loading Data 11. Controlling and Choosing Positions 12. Navigation Meshes and Agents 13. Cameras, Lighting, and Visual Effects 14. Shader Graphs and Video Players 15. Particle Systems and Other Visual Effects 16. Mobile Games and Applications 17. Augmented Reality (AR) 18. Virtual and Extended Reality (VR/XR) 19. Advanced Topics – Gizmos, Automated Testing, and More 20. Other Books You May Enjoy
21. Index

What this book covers

Chapter 1, Displaying Data with Core UI Elements, is filled with User Interface (UI) recipes to help you increase the entertainment and enjoyment value of your games through the quality of the visual elements displaying text and data. You’ll learn a wide range of UI techniques for displaying text and images.

Chapter 2, Responding to User Events for Interactive UIs, teaches you about updating displays, and detecting and responding to user input actions, such as mouseovers. There are recipes for panels in visual layers, radio buttons and toggle groups, interactive text entry, directional radars, countdown timers, and custom mouse cursors.

Chapter 3, Inventory and Advanced UIs, relates to the many games that involve the player collecting items, such as keys to open doors and ammo for weapons, or choosing from a selection of items, such as from a collection of spells to cast. The recipes in this chapter offer a range of text and graphical solutions for displaying inventory status to the player, including whether they are carrying an item or not and the maximum number of items they are able to collect.

Chapter 4, Playing and Manipulating Sounds, suggests ways to use sound effects and soundtrack music to make your game more interesting. The chapter demonstrates how to manipulate sound at runtime through the use of scripts, Reverb Zones, and the Audio Mixer. It also includes recipes for real-time graphics visualizations of playing sounds, and a recipe to create a simple 140 bpm loop manager.

Chapter 5, Textures, Materials, and 3D Objects, contains recipes that will give you a better understanding of how to create, import, and modify 3D objects in Scenes. Recipes for this chapter include controlling how objects look by changing their textures and transparency, as well as creating GameObjects by creating and manipulating geometric primitives such as cubes and spheres.

Chapter 6, Creating 3D Environments with Terrains, contains recipes that will give you a better understanding of how to create and modify the large-scale geography of a Scene using the Unity terrain tools. You’ll learn how to texture and height paint terrains, add holes, trees and vegetation, and also begin to explore the powerful, dynamic, realistic water features possible in HDRP (High Definition Render Pipeline) projects.

Chapter 7, Creating 3D Geometry with ProBuilder, contains recipes that will give you a better understanding of how to create and modify 3D objects within the Unity Editor using the powerful ProBuilder toolkit. As well as the basics of working with geometric meshes, you’ll learn to extrude, texture, and vertex paint objects, gaining the skills to quickly prototype terrains and objects for complex game levels.

Chapter 8, 2D Animation and Physics, introduces some of Unity’s powerful 2D animation and physics features. In this chapter, we present recipes to help you understand the relationships between the different animation elements in Unity, exploring the movement of different parts of the body and the use of sprite-sheet image files that contain sequences of sprite frame pictures. In this chapter, core Unity Animation concepts are presented, including Animation State Machines, Transitions, and Trigger events, as well as clipping via Sprite Masks. In addition, this chapter introduces the use of Tiles and Tilemaps for 2D games.

Chapter 9, Animated Character, focuses on character animation and demonstrates how to take advantage of Unity’s Mecanim animation system. It covers a range of subjects, from basic character setup to controlling character animations with the old and new input systems.

Chapter 10, Saving and Loading Data,explores how games running on devices can benefit from persistent file-based data, and also communication with other networked applications. In this chapter, a range of recipes are presented that illustrate how to save and load data between Scenes, how to read data from text files, how to set up an online, database-driven leaderboard, and how to write Unity games that can communicate with such online systems.

Chapter 11, Controlling and Choosing Positions, presents a range of recipes for 2D and 3D user- and computer-controlled objects and characters, which can lead to games with a richer and more exciting user experience. Examples of these recipes include spawn-points, checkpoints, and physics-based approaches, such as applying forces when clicking on objects and firing projectiles into the Scene.

Chapter 12, Navigation Meshes and Agents, explores ways that Unity’s NavMeshes and NavMesh Agents offer for the automation of object and character movement and pathfinding in your games. For example, recipes include ways to make objects follow predefined sequences of waypoints, or be controlled by mouse clicks for point-and-click control.

Chapter 13, Cameras, Lighting, and Visual Effects, presents recipes covering techniques for controlling and enhancing your game’s cameras. It offers solutions to work with both single and multiple cameras, illustrates how to apply post-processing effects, such as vignettes and grainy grayscale videos. The chapter also introduces ways to work with Unity’s powerful Cinemachine components. Other recipes in this chapter introduce visual effects including emissive materials and “cookie” textures, simulating objects casting shadows between the light source and the surfaces lights shine onto.

Chapter 14, Shader Graphs and Video Players, covers two powerful visual components in Unity: Shader Graphs and the Video Player. Both make it easy to add impressive visuals to your games with little or no programming. It includes recipes on how to simulate CCTV playback and download and play an online video, as well as an introduction to applying Shader Graphs in projects. Several recipes are presented for each of these features in this chapter.

Chapter 15, Particle Systems and Other Visual Effects, offers a hands-on approach to both using and repurposing Unity’s particle systems package, and also creating your own particle system from scratch.

Chapter 16, Mobile Games and Apps, provides an overview of and introduction to mobile projects in Unity. Since AR/VR/XR projects are mobile applications, this chapter acts as a foundation for those chapters too (Chapters 17 and 18).

Chapter 17, Augmented Reality (AR), provides an overview of and introduction to AR projects in Unity. The recipes guide you through exploring the Unity AR examples, then creating and configuring your own AR projects.

Chapter 18, Virtual and Extended Reality (VR/XR), provides an overview of and introduction to VR projects in Unity. Recipes include creating and configuring projects for VR, adding content, and building apps and deploying them onto devices or publishing them as WebXR via the web.

Chapter 19, Advanced Topics: Gizmos, Automated Testing, and More, explores a range of advanced topics, including creating your own gizmos to enhance design-time work in the Scene through visual grid guides with snapping. Automated code and runtime testing is also introduced, in addition to different approaches to saving and loading game data, and a final recipe introduces the new Python for Unity package, allowing scripting in the popular Python programming language.

lock icon The rest of the chapter is locked
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 €18.99/month. Cancel anytime