万本电子书0元读

万本电子书0元读

顶部广告

Unity 2017 Game Optimization - Second Edition: Optimize all aspects of Unity per电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Chris Dickinson

出  版  社:Packt Publishing

出版时间:2017-11-22

字       数:60.0万

所属分类: 进口书 > 外文原版书 > 科技/医学

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Master a series of performance-enhancing coding techniques and methods that help them improve the performance of their Unity3D applications About This Book Discover features and techniques to optimize Unity Engine's CPU cycles, memory usage, and the GPU throughput of any application Explore multiple techniques to solve performance issues with your VR projects Learn the best practices for project organization to save time through an improved workflow 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 your 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 by 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 your scenes as dynamic as possible by making the most of the Physics engine Organize, filter, and compress your art assets to maximize performance while maintaining high quality Discover different kinds of performance problems that are critical for VR projects and how to tackle them Use the Mono Framework and C# 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 Unity is an awesome game development engine. 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 book shows you how to make your games fly with the recent version of Unity 2017, and demonstrates that high performance does not need to be limited to games with the biggest teams and budgets. Since nothing turns gamers away from a game faster than a poor user-experience, the book starts by explaining how to use the Unity Profiler to detect problems. You will learn how to use stopwatches, timers and logging methods to diagnose the problem. You will then explore techniques to improve performance through better programming practices. Moving on, you will then learn about Unity's built-in batching processes; when they can be used to improve performance, and their limitations. Next, you will import your art assets using minimal space, CPU and memory at runtime, and discover some underused features and approaches for managing asset data. You will also improve graphics, particle system and shader performance with a series of tips and tricks to make the most of GPU parallel processing. You will then delve into the fundamental layers of the Unity3D engine to discuss some issues that may be difficult to understand without a strong knowledge of its inner-workings. The book also introduces you to the critical performance problems for VR projects and how to tackle them. By the end of the book, you will have learned to improve the development workflow by properly organizing assets and ways to instantiate assets as quickly and waste-free as possible via object pooling. Style and approach This practical book will help readers understand the essentials of the Unity3D engine and how to build games while improving the performance of their applications.
目录展开

Title Page

Second Edition

Copyright

Unity 2017 Game Optimization

Second Edition

Credits

About the Author

About the Reviewers

www.PacktPub.com

Why subscribe?

Customer Feedback

Software and Hardware List

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

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

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

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

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

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

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

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

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

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部