Book description
Master performance optimization for Unity3D applications with tips and techniques that cover every aspect of the Unity3D Engine
About This Book
- Optimize CPU cycles, memory usage, and GPU throughput for any Unity3D application
- Master optimization techniques across all Unity Engine features including Scripting, Asset Management, Physics, Graphics Features, and Shaders
- A practical guide to exploring Unity Engine's many performance-enhancing methods
Who This Book Is For
This book is intended for intermediate and advanced Unity developers who have experience with most of Unity's feature-set, and who want to maximize the performance of their game. Familiarity with the C# language will be needed.
What You Will Learn
- Use the Unity Profiler to find bottlenecks anywhere in our application, and discover how to resolve them
- Implement best-practices for C# scripting to avoid common pitfalls
- Develop a solid understanding of the rendering pipeline, and maximize its performance through reducing draw calls and avoiding fill rate bottlenecks
- Enhance shaders in a way that is accessible to most developers, optimizing them through subtle yet effective performance tweaks
- Keep our scenes as dynamic as possible by making the most of the Physics engine
- Organize, filter, and compress our art assets to maximize performance while maintaining high quality
- Pull back the veil on the Mono Framework and the C# Language to implement low-level enhancements that maximize memory usage and avoid garbage collection
- Get to know the best practices for project organization to save time through an improved workflow
In Detail
Competition within the gaming industry has become significantly fiercer in recent years with the adoption of game development frameworks such as Unity3D. Through its massive feature-set and ease-of-use, Unity helps put some of the best processing and rendering technology in the hands of hobbyists and professionals alike. This has led to an enormous explosion of talent, which has made it critical to ensure our games stand out from the crowd through a high level of quality. A good user experience is essential to create a solid product that our users will enjoy for many years to come.
Nothing turns gamers away from a game faster than a poor user-experience. Input latency, slow rendering, broken physics, stutters, freezes, and crashes are among a gamer's worst nightmares and it's up to us as game developers to ensure this never happens. High performance does not need to be limited to games with the biggest teams and budgets.
Initially, you will explore the major features of the Unity3D Engine from top to bottom, investigating a multitude of ways we can improve application performance starting with the detection and analysis of bottlenecks. You'll then gain an understanding of possible solutions and how to implement them. You will then learn everything you need to know about where performance bottlenecks can be found, why they happen, and how to work around them.
This book gathers a massive wealth of knowledge together in one place, saving many hours of research and can be used as a quick reference to solve specific issues that arise during product development.
Style and approach
This book is organized based on the major features of Unity engine and should be treated as a reference guide. It is written as a series of investigations into both common and unusual performance pitfalls, each including a study on why the bottleneck is causing us problems, and a list of enhancements or features that can be used to work around them. Differences in effectiveness, behaviors, or feature-sets between Unity 4.x and Unity 5.x will be highlighted.
Table of contents
-
Unity 5 Game Optimization
- Table of Contents
- Unity 5 Game Optimization
- Credits
- About the Author
- Acknowledgments
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. Detecting Performance Issues
-
2. Scripting Strategies
- Cache Component references
- Obtaining Components using the fastest method
- Removing empty callback declarations
- Avoiding the Find() and SendMessage() methods at runtime
- Disabling unused scripts and objects
- Consider using distance-squared over distance
- Avoid retrieving string properties from GameObjects
- Update, Coroutines, and InvokeRepeating
- Consider caching Transform changes
- Faster GameObject null reference checks
- Summary
- 3. The Benefits of Batching
-
4. Kickstart Your Art
-
Audio
- Loading audio files
- Encoding formats and quality levels
-
Audio performance enhancements
- Minimize active Audio Source count
- Minimize Audio Clip references
- Enable Force to Mono for 3D sounds
- Resample to lower frequencies
- Consider all encoding formats
- Beware of streaming
- Apply Filter effects through Mixer groups to reduce duplication
- Use "WWW.audioClip" responsibly
- Consider Audio Module files for background music
- Texture files
- Mesh and animation files
- Summary
-
Audio
-
5. Faster Physics
- Physics Engine internals
-
Physics performance optimizations
- Scene setup
- Use Static Colliders appropriately
- Optimize the Collision Matrix
- Prefer discrete collision detection
- Modify the FixedUpdate frequency
- Adjust the Maximum Allowed Timestep
- Minimize cast and bounding-volume checks
- Avoid complex Mesh Colliders
- Avoid complex physics components
- Let physics objects sleep
- Modify Solver Iteration Count
- Optimizing ragdolls
- Know when to use physics
- Consider upgrading to Unity 5
- Summary
-
6. Dynamic Graphics
- Profiling rendering issues
- Front end bottlenecks
-
Back end bottlenecks
-
Fill rate
- Overdraw
- Occlusion Culling
- Shader optimization
-
Consider using Shaders intended for mobile platforms
- Use small data types
- Avoid changing precision while swizzling
- Use GPU-optimized helper functions
- Disable unnecessary features
- Remove unnecessary input data
- Only expose necessary variables
- Reduce mathematical complexity
- Reduce texture lookups
- Avoid conditional statements
- Reduce data dependencies
- Surface Shaders
- Use Shader-based LOD
- Memory bandwidth
- VRAM limits
-
Fill rate
- Lighting and Shadowing
- Optimizing graphics for mobile
- Summary
- 7. Masterful Memory Management
- 8. Tactical Tips and Tricks
- Index
Product information
- Title: Unity 5 Game Optimization
- Author(s):
- Release date: November 2015
- Publisher(s): Packt Publishing
- ISBN: 9781785884580
You might also like
book
Unity 2017 Game Optimization - Second Edition
Master a series of performance-enhancing coding techniques and methods that help them improve the performance of …
book
Getting Started with Unity 5.x 2D Game Development
Build a tower defense game and earn delectable C# treats by baking cupcakes and fighting fearsome …
book
2D Game Development with Unity
This book teaches beginners and aspiring game developers how to develop 2D games with Unity. Thousands …
book
C# Game Programming Cookbook for Unity 3D
An Accessible, Modular Style of Game Building-Easily Start Making Games with Unity 3DC# Game Programming Cookbook …