Search icon CANCEL
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 2018 Cookbook

You're reading from   Unity 2018 Cookbook Over 160 recipes to take your 2D and 3D game development to the next level

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781788471909
Length 794 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Matt Smith Matt Smith
Author Profile Icon Matt Smith
Matt Smith
Francisco Queiroz Francisco Queiroz
Author Profile Icon Francisco Queiroz
Francisco Queiroz
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Displaying Data with Core UI Elements FREE CHAPTER 2. Responding to User Events for Interactive UIs 3. Inventory UIs 4. Playing and Manipulating Sounds 5. Creating Textures, Maps, and Materials 6. Shader Graphs and Video Players 7. Using Cameras 8. Lights and Effects 9. 2D Animation 10. 3D Animation 11. Webserver Communication and Online Version-Control 12. Controlling and Choosing Positions 13. Navigation Meshes and Agents 14. Design Patterns 15. Editor Extensions and Immediate Mode GUI (IMGUI) 16. Working with External Resource Files and Devices 17. Working with Plain Text, XML, and JSON Text Files 18. Virtual Reality and Extra Features 19. Automated Testing 20. Bonus Chapters 21. Other Books You May Enjoy

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, including displaying text and images, 3D text effects, and an introduction to displaying text and image dialogues with the free Fungus package.

Chapter 2, Responding to User Events for Interactive UIs, teaches you about updating displays (for example basic on timers), and detecting and responding to user input actions, such as mouseovers, while the first chapter introduced code UI for displaying values to the user. Among other things, 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 UIs, relates to the many games that involve the player collecting items, such as keys to open doors, 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, or 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 during 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 ends with a recipe to create a simple 140 bpm loop manager, with visualizations of each playing loop.

Chapter 5, Creating Textures, Maps and Materials, contains recipes that will give you a better understanding of how to use maps and materials with the Physically-Based Shaders, whether you are a game artist or not. It's a great resource for exercising your image editing skills.

Chapter 6, Shader Graphs and Video Players, covers two recent visual components that Unity has added: Shader Graphs and the Video Player. Both make it easy to add impressive visuals to your games with little or no programming. Several recipes are presented for each of these features in this chapter.

Chapter 7, Using Cameras, presents recipes covering techniques for controlling and enhancing your game's camera(s). It offers solutions to work with both single and multiple cameras, illustrates how to apply Post-Processing effects, such as vignettes and grainy gray-scale CCTVs. The chapter concludes by introducing ways to work with Unity's powerful Cinemachine components.

Chapter 8, Lights and Effects, offers a hands-on approach to several of Unity's lighting system features, such as cookie textures, Reflection maps, Lightmaps, Light and Reflection probes, and Procedural Skyboxes. Also, it demonstrates the use of Projectors.

Chapter 9, 2D Animation, introduces some of Unity's powerful 2D animation and physics features. In this chapter, we will present recipes to help you understand the relationships between the different animation elements in Unity, exploring both the movement of different parts of the body and the use of sprite-sheet image files that contain sequences of sprite frames pictures. In this chapter core, Unity Animation concepts, including Animation State Charts, Transitions, and Trigger events, are also introduced. Finally, 2D games often make use of Tiles and Tilemaps (now features that are part of Unity), and these features, as well as the Unity 3D Gamekit, are all introduced in the recipes of this chapter.

Chapter 10, 3D Animation, focuses on character animation and demonstrates how to take advantage of Unity's animation system—Mecanim. It covers a range of subjects, from basic character setup to procedural animation and ragdoll physics. It also offers introductions to some of the newer Unity 3D features, such as Probuilder and the Unity 3D Gamekit.

Chapter 11, Webserver Communication, and Online Version Control, explores how games running on devices can benefit from communication with other networked applications. In this chapter, a range of recipes are presented, which illustrate how to set up an online, database-driven leaderboard, how to write Unity games that can communicate with such online systems, and ways to protect your games from running on unauthorized servers (to prevent your WebGL games being illegally copied and published on other people's servers. In addition, the recipes illustrate how to structure your projects so that they can be easily backed up using online version control systems such as GitHub, and also how to download projects from online sites to edit and run on our own machine.

Chapter 12, Controlling and Choosing Positions, presents a range of recipes for 2D and 3D users 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 13, Navigation Meshes and Agents, explores ways that Unity's Nav Meshes and Nav Mesh Agents offer for the automation of object and character movement and pathfinding in your games. Objects can follow predefined sequences of waypoints, or be controlled by mouse clicks for point-and-click control. Objects can be made to flock together based on the average location and movement of all members of their flock. Additional recipes illustrate how the "cost" of navigation areas can be defined, simulating hard-to-travel areas such as mud and water. Finally, although much navigation behavior is pre-calculated at Design Time (the "baking" process), a recipe is presented illustrating how movable objects can influence path-finding at runtime through the use of the NavMesh Obstacle component.

Chapter 14, Design Patterns, illustrates software design patterns that are reusable, and computer-language independent templates for how to solve common problems. It teaches to avoid reinventing the wheel, learn about tried-and-tested approaches to solving common features for game projects. This chapter introduces several design patterns relevant to games, including the State pattern, the publisher-subscriber pattern, and the model-view-controller pattern.

Chapter 15, Editor Extensions and Immediate Mode GUI (IMGUI), provides several recipes for enhancing design-time work in the Unity Editor. Editor Extensions are scripting and multimedia components, which allow working with custom text, UI presentation of the game parameters, data in the Inspector and Scene panels, and custom menus and menu items. These can facilitate workflow improvements, allowing game developers to achieve their goals quicker and easier. Some of the recipes in this chapter include menu items, interactive panels with persistent storage, registering actions for the Undo system, deactivating menu items, progress bars, and ways to create new GameObjects based on prefabs.

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