Thursday, February 13, 2020

UNITY PERFORMANCE: Checklist for a Top-Performing Game in 2020+

https://thegamedev.guru/unity-performance/checklist/?utm_campaign=meetedgar&utm_medium=social&utm_source=meetedgar.com&fbclid=IwAR1dEF_zH1kyejvG4emeyt8mLSA_7RSBbgbXhGq5dMZ5oZmcRW_U6P_7vIg#tab-con-5

CHAPTER 1: 
Unity CPU Performance Checklist
Rendering: Use a single camera, especially in mobile


Rendering: Try lighter APIs such as Vulkan or Metal


Rendering: Are you using occlusion culling for interiors?


Rendering: Pre-bake 24/7: lighting, shadows, reflection probes*


Rendering: Create atlases to reduce Unity SetPasses and Draw Calls below 100 on mobile. No multi-material assets (evil asset store)


Rendering: Leave all static and dynamic batching on*


Rendering: Keep particle systems small in world space — i.e. small bounding boxes


Rendering: Are all your particle systems procedural?


UI: Use color property instead of in-sprite color variations and use the new SpriteAtlas tool


UI: Watch "Unite '17 Seoul - Tips and Tricks for Optimising Unity UI"


UI: Avoid per-frame changes in UI components (UI properties or RectTransforms)


UI: Don't use auto-layouting components on dynamic UI


PlayerSettings: Keep only the target architecture you're really building for


PlayerSettings: Use il2cpp in master mode, disable script debugging


PlayerSettings: Use GPU skinning*


GraphicsSettings: Enable only necessary built-in shader settings


Animation: Enable Optimize Game Objects on rigging import settings


Animation: Use animators exclusively in characters. For the rest: custom scripts or tweens.


Animation: Reduce blend tree complexity in animations


Animation: Reduce bone and vertex count for skinning. Aim for max 2 bones on mobile


VR: Use single-pass stereo


OculusVR: Set CPU level to 4*


Unity Scene Hierarchy: Don't forget scene hierarchy static flags on static game objects


Unity Scene Hierarchy: dynamic root objects are less than 3 levels deep and have less than 50 total children


AudioClip (longer ones): Decompress on load and load in background*


Multithreading: Use Burst and tweak the job system job count parameter if needed


Scripting: Coroutines are not endless and use small local variables


Scripting: Use interlaced logic execution whenever possible


Scripting: use CullingGroups to pause out-of-screen subsystems


Scripting (10+ entities): Use your own UpdateManager + ManualUpdates instead of relying on Update. Also, try DOTS.


Physics: Disable autosync transforms end enable reuse collision callbacks


Physics: Avoid mesh colliders; if needed, enable read/write on its mesh importer


CHAPTER 2: 
Unity GPU Performance Checklist
General: No post-processing nor real-time shadows on mobile


General: Use 4x MSAA on (most) mobile platforms


General: Set optimal compression mode for textures, meshes, etc..


General: Use forward rendering and disable HDR on mobile


General: Avoid baked reflection on mobile; RT are forbidden


General: Use 0 (or max. 1) real-time pixel lights on mobile


General: Disable soft particles on mobile


Overdraw: Avoid transparent regions in your sprites. Cut them


Overdraw: Avoid stacking more than 2 UI layers on top of each other


Overdraw: Consider opaque UI with alpha to coverage to reduce overdraw (advanced)


Overdraw: check opaque geometry is rendered front-to-back with frame debugger; this often breaks with batching


Geometry: Use LODs for high-poly models and consider impostor rendering to get < 300k vertices/poligons on mobile


VR: Consider reducing render resolution (backup solution)


OculusVR: Set Oculus GPU level to 4*


Shaders: Avoid multi-pass shaders


Shaders: No standard shader, no GrabPass on mobile


Shaders: Use necessary decimal precision only (half vs float) on mobile


Shaders: avoid sampling from reflection probes


Shaders: Avoid conditionals


Color Space: use gamma instead of linear on mobile

CHAPTER 3: 
Unity Memory Performance Checklist

Capacity: Use indirect references instead of direct references for heavy content


Capacity: Remove direct references to inaccessible content


Capacity: Global GameObjects shouldn't direct-reference heavy content


Capacity: Seldomly used scene GameObjects shouldn't direct-reference heavy content


Capacity: Try texture streaming*


Capacity: Set optimal compression settings for textures, meshes, animations, etc..


Capacity: Disable read/write asset import setting whenever possible


GC: Reduce memory allocations to avoid growing the reserved heap size


AudioClips: enable streaming on long clips*


Performance: Avoid Resources directory


Performance: Preload commonly used shaders to avoid gameplay spikes and strip unused shaders


Performance: Try incremental Garbage Collector to reduce spikes*​


Performance: Use indirect-referenced object pools to reduce spikes


GC: Control GC manually for fine control (advanced)


GC: Avoid garbage-generating methods such as FindObjectsOfType


GC: Aim for less than 32 bytes of memory allocations per frame


GC: Avoid C# boxing


BuildSize: Reduce build sizes with CDNs

No comments:

Post a Comment