
Unity 2017 Game Optimization
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Person
Chris Dickinson grew up in a quiet little corner of England with a strong passion for mathematics, science and, in particular, video games. He loved playing them, dissecting their gameplay, and trying to figure out how they worked. Watching his dad hack the hex code of a PC game to get around the early days of copy protection completely blew his mind! His passion for science won the battle at the time; however, after completing a master's degree in physics with electronics, he flew out to California to work in the field of scientific research in the heart of Silicon Valley. Shortly afterward, he had to admit to himself that research work was an unsuitable career path for his temperament. After firing resumes in all directions, he landed a job that finally set him on the correct course in the field of software engineering (this is not uncommon for physics grads, I hear). His time working as an automated tools developer for IPBX phone systems fit his temperament much better. Now he was figuring out complex chains of devices, helping its developers fix and improve them, and building tools of his own. Chris learned a lot about how to work with big, complex, real-time, event-based, user-input driven state machines (sounds familiar?). Being mostly self-taught at this point, Chris's passion for video games was flaring up again, pushing him to really figure out how video games were built. Once he felt confident enough, he returned to school for a bachelor's degree in game and simulation programming. By the time he was done, he was already hacking together his own (albeit rudimentary) game engines in C++ and regularly making use of those skills during his day job. However, if you want to build games, you should just build games, and not game engines. So, Chris picked his favorite publically available game engine at the time--an excellent little tool called Unity 3D--and started hammering out some games. After a brief stint of indie game development, Chris regretfully decided that the demands of that particular career path weren't for him, but the amount of knowledge he had accumulated in just a few short years was impressive by most standards, and he loved to make use of it in ways that enabled other developers with their creations. Since then, Chris has authored a tutorial book on game physics (Learning Game Physics with Bullet Physics and OpenGL, Packt Publishing) and two editions of a Unity performance optimization book (which you are currently reading). He has married the love of his life, Jamie, and works with some of the coolest modern technology as a software development engineer in Test (SDET) at Jaunt Inc. in San Mateo, CA, a Virtual Reality/Augmented Reality startup that focuses on delivering VR and AR experiences, such as 360 videos (and more!). Outside of work, Chris continues to fight an addiction to board games (particularly Battlestar: Galactica and Blood Rage), an obsession with Blizzard's Overwatch and Starcraft II, cater to the ever-growing list of demands from a pair of grumpy yet adorable cats, and gazing forlornly at the latest versions of Unity with a bunch of game ideas floating around on paper. Someday soon, when the time is right (and when he stops slacking off), his plans may come to fruition
Content
- Cover
- Copyright
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Customer Feedback
- Table of Contents
- Preface
- Chapter 1: Pursuing Performance Problems
- The Unity Profiler
- Launching the Profiler
- Editor or standalone instances
- Connecting to a WebGL instance
- Remote connection to an iOS device
- Remote connection to an Android device
- Editor profiling
- The Profiler window
- Profiler controls
- Add Profiler
- Record
- Deep Profile
- Profile Editor
- Connected Player
- Clear
- Load
- Save
- Frame Selection
- Timeline View
- Breakdown View Controls
- Breakdown View
- The CPU Usage Area
- The GPU Usage Area
- The Rendering Area
- The Memory Area
- The Audio Area
- The Physics 3D and Physics 2D Areas
- The Network Messages and Network Operations Areas
- The Video Area
- The UI and UI Details Areas
- The Global Illumination Area
- Best approaches to performance analysis
- Verifying script presence
- Verifying script count
- Verifying the order of events
- Minimizing ongoing code changes
- Minimizing internal distractions
- Minimizing external distractions
- Targeted profiling of code segments
- Profiler script control
- Custom CPU Profiling
- Final thoughts on Profiling and Analysis
- Understanding the Profiler
- Reducing noise
- Focusing on the issue
- Summary
- Chapter 2: Scripting Strategies
- Obtain Components using the fastest method
- Remove empty callback definitions
- Cache Component references
- Share calculation output
- Update, Coroutines, and InvokeRepeating
- Faster GameObject null reference checks
- Avoid retrieving string properties from GameObjects
- Use appropriate data structures
- Avoid re-parenting Transforms at runtime
- Consider caching Transform changes
- Avoid Find() and SendMessage() at runtime
- Assigning references to pre-existing objects
- Static Classes
- Singleton Components
- A global Messaging System
- A globally accessible object
- Registration
- Message processing
- Implementing the Messaging System
- Message queuing and processing
- Implementing custom messages
- Message sending
- Message registration
- Message cleanup
- Wrapping up the Messaging System
- Disable unused scripts and objects
- Disabling objects by visibility
- Disabling objects by distance
- Consider using distance-squared over distance
- Minimize Deserialization behavior
- Reduce serialized object size
- Load serialized objects asynchronously
- Keep previously loaded serialized objects in memory
- Move common data into ScriptableObjects
- Load scenes additively and asynchronously
- Create a custom Update() layer
- Summary
- Chapter 3: The Benefits of Batching
- Draw Calls
- Materials and Shaders
- The Frame Debugger
- Dynamic Batching
- Vertex attributes
- Mesh scaling
- Dynamic Batching summary
- Static Batching
- The Static flag
- Memory requirements
- Material references
- Static Batching caveats
- Edit Mode debugging of Static Batching
- Instantiating static meshes at runtime
- Static Batching summary
- Summary
- Chapter 4: Kickstart Your Art
- Audio
- Importing audio files
- Loading audio files
- Encoding formats and quality levels
- Audio performance enhancements
- Minimize active Audio Source count
- Enable Force to Mono for 3D sounds
- Resample to lower frequencies
- Consider all compression formats
- Beware of streaming
- Apply Filter Effects through Mixer Groups to reduce duplication
- Use remote content streaming responsibly
- Consider Audio Module files for background music
- Texture files
- Texture compression formats
- Texture performance enhancements
- Reduce texture file size
- Use Mip Maps wisely
- Manage resolution downscaling externally
- Adjust Anisotropic Filtering levels
- Consider Atlasing
- Adjust compression rates for non-square textures
- Sparse Textures
- Procedural Materials
- Asynchronous Texture Uploading
- Mesh and animation files
- Reduce polygon count
- Tweak Mesh Compression
- Use Read-Write Enabled appropriately
- Consider baked animations
- Combine meshes
- Asset Bundles and Resources
- Summary
- Chapter 5: Faster Physics
- Physics Engine internals
- Physics and time
- Maximum Allowed Timestep
- Physics updates and runtime changes
- Static Colliders and Dynamic Colliders
- Collision detection
- Collider types
- The Collision Matrix
- Rigidbody active and sleeping states
- Ray and object casting
- Debugging Physics
- Physics performance optimizations
- Scene setup
- Scaling
- Positioning
- Mass
- Use Static Colliders appropriately
- Use Trigger Volumes responsibly
- Optimize the Collision Matrix
- Prefer Discrete collision detection
- Modify the Fixed Update frequency
- Adjust the Maximum Allowed Timestep
- Minimize Raycasting and bounding-volume checks
- Avoid complex Mesh Colliders
- Use simpler primitives
- Use simpler Mesh Colliders
- Avoid complex physics Components
- Let physics objects sleep
- Modify the Solver Iteration Count
- Optimize Ragdolls
- Reduce Joints and Colliders
- Avoid inter-Ragdoll collisions
- Replace, deactivate or remove inactive Ragdolls
- Know when to use physics
- Summary
- Chapter 6 : Dynamic Graphics
- The Rendering Pipeline
- The GPU Front End
- The GPU Back End
- Fill Rate
- Overdraw
- Memory Bandwidth
- Lighting and Shadowing
- Forward Rendering
- Deferred Rendering
- Vertex Lit Shading (legacy)
- Global Illumination
- Multithreaded Rendering
- Low-level rendering APIs
- Detecting performance issues
- Profiling rendering issues
- Brute-force testing
- Rendering performance enhancements
- Enable/Disable GPU Skinning
- Reduce geometric complexity
- Reduce Tessellation
- Employ GPU Instancing
- Use mesh-based Level Of Detail (LOD)
- Culling Groups
- Make use of Occlusion Culling
- Optimizing Particle Systems
- Make use of Particle System Culling
- Avoid recursive Particle System calls
- Optimizing Unity UI
- Use more Canvases
- Separate objects between static and dynamic canvases
- Disable Raycast Target for noninteractive elements
- Hide UI elements by disabling the parent Canvas Component
- Avoid Animator Components
- Explicitly define the Event Camera for World Space Canvases
- Don't use alpha to hide UI elements
- Optimizing ScrollRects
- Make sure to use a RectMask2D
- Disable Pixel Perfect for ScrollRects
- Manually stop ScrollRect motion
- Use empty UIText elements for full-screen interaction
- Check the Unity UI source code
- Check the documentation
- 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
- Expose only necessary variables
- Reduce mathematical complexity
- Reduce texture sampling
- Avoid conditional statements
- Reduce data dependencies
- Surface Shaders
- Use Shader-based LOD
- Use less texture data
- Test different GPU Texture Compression formats
- Minimize texture swapping
- VRAM limits
- Preload textures with hidden GameObjects
- Avoid texture thrashing
- Lighting optimization
- Use real-time Shadows responsibly
- Use Culling Masks
- Use baked Lightmaps
- Optimizing rendering performance for mobile devices
- Avoid Alpha Testing
- Minimize Draw Calls
- Minimize Material count
- Minimize texture size
- Make textures square and power-of-two
- Use the lowest possible precision formats in Shaders
- Summary
- Chapter 7: Virtual Velocity and Augmented Acceleration
- XR Development
- Emulation
- User comfort
- Performance enhancements
- The kitchen sink
- Single-Pass versus Multi-Pass Stereo Rendering
- Apply anti-aliasing
- Prefer Forward Rendering
- Image effects in VR
- Backface culling
- Spatialized audio
- Avoid camera physics collisions
- Avoid Euler angles
- Exercise restraint
- Keep up to date with the latest developments
- Summary
- Chapter 8: Masterful Memory Management
- The Mono platform
- Memory Domains
- Garbage collection
- Memory Fragmentation
- Garbage collection at runtime
- Threaded garbage collection
- Code compilation
- IL2CPP
- Profiling memory
- Profiling memory consumption
- Profiling memory efficiency
- Memory management performance enhancements
- Garbage collection tactics
- Manual JIT compilation
- Value types and Reference types
- Pass by value and by reference
- Structs are Value types
- Arrays are Reference types
- Strings are immutable Reference types
- String concatenation
- StringBuilder
- String formatting
- Boxing
- The importance of data layout
- Arrays from the Unity API
- Using InstanceIDs for dictionary keys
- foreach loops
- Coroutines
- Closures
- The .NET library functions
- Temporary work buffers
- Object Pooling
- Prefab Pooling
- Poolable Components
- The Prefab Pooling System
- Prefab pools
- Object spawning
- Instance prespawning
- Object despawning
- Prefab pool testing
- Prefab Pooling and Scene loading
- Prefab Pooling summary
- IL2CPP optimizations
- WebGL optimizations
- The future of Unity, Mono, and IL2CPP
- The upcoming C# Job System
- Summary
- Chapter 9 Tactical Tips and Tricks
- Editor hotkey tips
- GameObjects
- Scene window
- Arrays
- Interface
- In-editor documentation
- Editor UI tips
- Script Execution Order
- Editor files
- The Inspector window
- The Project window
- The Hierarchy window
- The Scene and Game windows
- Play Mode
- Scripting tips
- General
- Attributes
- Variable attributes
- Class attributes
- Logging
- Useful links
- Custom Editor scripts and menu tips
- External tips
- Other tips
- Summary
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.