Tools for profiling and debugging
Every game creator knows that smooth performance is essential to creating immersive gaming experiences – and to achieve that, you need to profile your game.
Get an overview of the profiling and debugging tools available with Unity and those available for target platforms.
The information here is excerpted from the e-book, Ultimate guide to profiling Unity games, available to download for free. The e-book was created by both external and internal Unity experts in game development, profiling, and optimization.
Profiling is like detective work, unraveling the mysteries of why performance in your application is lagging, or why code is allocating excess memory. The best gains from profiling are made when you plan early on in your project’s development lifecycle. It’s an ongoing proactive and iterative process. By profiling early and often, rather than just before you are about to ship your game, you and your team can understand and establish a “performance signature” for the project. If performance takes a nosedive, for instance, you’ll be able to easily spot when things go wrong, and quickly remedy the issue.
The most accurate profiling results come from running and profiling builds on target devices, as well as using platform-specific tooling to dig into the hardware characteristics of each targeted platform.
Unity ships with a range of free and powerful profiling tools for analyzing and optimizing your code, both in-Editor and on hardware. There are also several great native profiling tools designed for each target platform, such as those available from Arm, Apple, Sony, and Microsoft. Using a combination of both provides a more holistic view of application performance across all target devices.
Unity’s profiling tools are available in the Editor and the Package Manager. Each tool specializes in profiling various parts of your project:
- The Unity Profiler helps you measure project performance and identify which processes could be causing problems. The Profiler gathers and displays data, such as how much CPU time is being used for different tasks, from audio and physics to rendering and animation. It measures the performance of the Unity Editor, your application in Play mode, and connects to the device running your application in Development mode. Use this essential tool to start profiling. Check out this course on profiling to begin.
- The Memory Profiler provides an in-depth analysis of memory performance. Reducing memory usage will help you reduce crashes, decrease loading time, and make your project compatible with older devices. The Memory Profiler is currently in preview but is expected to be verified in Unity 2022 LTS.
- The Profile Analyzer aggregates and visualizes both frame and marker data from a set of Unity Profiler frames to help you examine their behavior over many frames. (This complements the single-frame analysis already available in the Unity Profiler.) It also allows you to compare two profiling datasets to determine how your changes impact the application’s performance.
- The Frame Debugger lets you freeze playback for a running game on a particular frame, and then view the individual draw calls used to render that frame. In addition to listing the draw calls, the debugger lets you step through them one at a time, so you can see how the scene is constructed from its graphical elements.
- The Profiling Core package provides APIs for adding contextual information to Unity Profiler captures.
Android / Arm
- Android Studio: The latest Android Studio includes a new Android Profiler that replaces the previous Android Monitor tools. Use it to gather real-time data about hardware resources on Android devices.
- Arm Mobile Studio: A suite of tools to help you profile and debug your games in great detail, catered for devices running Arm hardware.
- Snapdragon Profiler: Specifically for Snapdragon chipset devices only. Analyze CPU, GPU, DSP, memory, power, thermal, and network data to help find and fix performance bottlenecks.
Intel
- Intel VTune: Quickly find and fix performance bottlenecks on Intel platforms with this suite of tools. For Intel processors only.
- Intel GPA suite: A suite of graphics focused tools to help you improve your game’s performance by quickly identifying problem areas.
Xbox / Windows
- PIX: PIX is a performance tuning and debugging tool for Windows and Xbox game developers using DirectX 12. It includes tools for understanding and analyzing CPU and GPU performance as well as monitoring various real-time performance counters. For more information on leveraging PIX for Xbox game development, register as an Xbox developer.
PC / Universal
- AMD μProf: AMD uProf is a performance analysis tool for understanding and profiling performance for applications running on AMD hardware.
- NVIDIA NSight: Tooling that enables developers to build, debug, profile, and develop class-leading and cutting-edge software using the latest visual computing hardware from NVIDIA.
- Superluminal: Superluminal is a high-performance, high-frequency profiler that supports profiling applications on Windows, Xbox One, and PlayStation written in C++, Rust and .NET. It is a paid product, though, and must be licensed to be used.
PlayStation
- CPU profiler tools are available for PlayStation hardware. For more details, you need to be a registered PlayStation® developer.
iOS
- Xcode Instruments and the Xcode Frame Debugger: Instruments is a powerful and flexible performance-analysis and testing tool that’s part of the Xcode toolset.
WebGL
- Firefox Profiler: Dig into the call stacks and view flame graphs for Unity WebGL builds (among other things) with the Firefox Profiler. It also features a comparison tool to look at profiling captures side by side.
- Chrome DevTools Performance: Another web browser tool that can be used to profile Unity WebGL builds.
While the Unity Frame Debugger tool captures and illustrates draw calls that are sent from the CPU, the following tools can help show you what the GPU does when it receives those commands.
Some are platform-specific and offer closer platform integration. Take a look at the tools relevant to the platforms of interest:
- Arm Graphics Analyzer: Part of Arm’s Mobile Studio software suite
- RenderDoc: GPU debugger for desktop and mobile platforms
- Intel GPA: Graphics profiling for Intel-based platforms
- Apple Frame Capture Debugging Tools: GPU debugging for Apple platforms
- Visual Studio Graphics Diagnostics: Choose this and/or PIX for DirectX-based platforms such as Windows or Xbox
- NVIDIA Nsight Frame Debugger: OpenGL-based frame debugger for NVIDIA GPUs
- AMD Radeon Developer Tool Suite: GPU profiler for AMD GPUs
- Xcode frame debugger: For iOS and macOS
Download the e-book, Ultimate guide to profiling Unity games, for free to get all the tips and best practices.