Search Unity

Games Focus: Profiling and performance optimization

September 28, 2022 in Engine & platform | 11 min. read
Games Focus blog 03, hero image
Games Focus blog 03, hero image
Share

Is this article helpful for you?

Thank you for your feedback!

This is the third blog in our Games Focus series, which highlights key product development initiatives for the year ahead and beyond. Here, we cover the status, upcoming release plans, and future vision for profiling and performance at Unity. 

My name is Marika. I’ve worked in the video game industry for nearly a decade, and I’m currently the senior technical product manager for profiling tools and performance optimization at Unity.

When we think about performance at Unity, there are three main areas where we believe we can help:

  • Insight: Empowering you to dig into your game’s performance, identify bottlenecks, and pinpoint areas that would benefit from optimization strategies
  • Experience: Ensuring that creating your projects feels seamless by raising the performance of the Unity Editor and runtime
  • Innovation: Guiding you in new programming techniques and paradigms that have performance in mind from the ground up

Today’s post focuses on the first two areas, covering recent updates to our suite of profiling tools and how customer feedback is shaping our roadmap for 2023 and beyond. It ends with a recap on best practices for optimizing projects. 

We’ll dive into the third area, performance-focused programming techniques and workflows with a focus on DOTS-based projects, in an upcoming post.

Profiling in Unity

We like to think of the profiling features in Unity as detective tools that help you unravel the mysteries of why performance in your application is slow or glitchy, or why code is allocating excess memory. They help you understand what’s going on under the hood of the Unity game engine.

Our goal is to raise the performance of Unity tools and runtime through profiling and optimization, helping you to deliver smooth performance for your players across a broad range of platforms and devices.

What’s ready for you today

Memory Profiler is designed to make it easier to keep track of memory usage and composition. I’m happy to share that the Memory Profiler 1.0.0 is now a verified package for the Unity 2022.2 beta release and above (find instructions for download here). Thank you to everyone who shared their invaluable feedback on how to create a better workflow for this important feature.

Many of you contend with the challenge of working within the memory restrictions of each of your target platforms. The Memory Profiler helps solve this challenge by providing you with a clear overview of the memory impact of assets and objects in one view. It also shows you detailed contextual information on which objects and systems the memory relates to.

You can dig deeper into the capture through breakdown views and compare memory snapshots to identify potential leaks and unnecessary allocations that negatively impact memory usage.

The Summary tab provides an overview of total memory used. The Unity Objects tab shows any Unity objects that use memory, while the All of Memory tab displays a breakdown of all the memory in the snapshot that Unity tracks.
The Summary tab provides an overview of total memory used. The Unity Objects tab shows any Unity objects that use memory, while the All of Memory tab displays a breakdown of all the memory in the snapshot that Unity tracks.
You can compare memory usage between two memory snapshots.
You can compare memory usage between two memory snapshots.

Refining the existing profiling toolset

In 2022.1, we added the Frame Timing Manager, which enables you to capture and access frame timing data across multiple frames. If performance is lagging, use this feature to assess frames and analyze why your application isn’t meeting performance targets. Learn more about this in our documentation.

If you’re looking to monitor low-level GPU metrics in the Unity Profiler, you can use the new System Metrics Mali package, which we released in 2022.1 through a partnership with Arm. This package allows you to access low-level system or hardware metrics on mobile devices. If you’re curious to learn more about how to ensure your content runs smoothly on mobile devices powered by Arm CPUs and Mali GPUs, this 2021 blog can guide you.

Performance optimization

The profiling tools highlighted so far are a great start to helping you identify areas where performance can be improved. On my team, however, “performance optimization” applies not only to your games’ runtime performance on their target devices, but also to how your team works – your productivity. We’re aiming to provide you with faster iteration times, fewer interruptions, and greater efficiency in the Editor.

In Unity 2021 LTS, importing your assets is three to four times faster, and opening imported projects up to 8.7% faster compared to Unity 2020 LTS. 

I’m excited to share some of the improvements that are available in the 2022 releases as well:

  • Improved material reimport for the Universal Render Pipeline and High Definition Render Pipeline
  • Editor workflow improvements, including:
    • Faster save time for large scenes
    • Reduced stall time in scene picking
    • Improved performance in the Scene view when there are many LOD Groups
    • An optimized animation rigging package
    • Better Hierarchy scrolling
    • Improved save workflow for large Prefabs
    • Improved iteration time when working inside the Editor thru optimizations on domain reloads
  • Play mode improvements, including:
    • Improved static batching performance
    • Optimized process for how Addressables finds resource directories
    • Prewarming particle systems

Again, your feedback has played a vital role in many of these improvements. Please continue sharing your feedback on our future roadmap here, or contact the team on the forums. We’re particularly interested in performance-related issues, which we’re capturing here.

What’s next

For over a decade, we’ve stayed focused on ensuring that you can achieve the best performance possible using our profiling tools, and we will continue refining the toolset. This development has taken many forms, including all of the functionality we’ve already mentioned here.

Another area where we’ve worked to provide significant performance gains is the Data-Oriented Technology Stack, or DOTS. Two of the core features integral to the successful delivery of DOTS are the Burst compiler and C# Job System. These were leveraged in our own internal engine performance to great results, and they’re available for all today. Coming soon, we’ll deliver on the third critical feature, Entities, which will turbo boost project performance in areas like networking, physics, and more. This is such an important aspect to our commitment to game development that we will dedicate a standalone Games Focus article to DOTS in this series, coming soon.

For now, let’s take a look at a few improvements planned for upcoming releases.

We’re working to cut time spent starting the Editor, to improve start-up time and help you stay in flow. Today, when you connect a target device to the Editor, you might experience instability such as disconnection or an inability to recover. We’re working on making Editor connections to mobile platforms more reliable and performant in the 2023.1 release.

Additionally, we want to make it more efficient for you to identify bottlenecks with the Profiler and to know what to do next once you’ve spotted them. Our goal is to quickly direct you to the areas of optimization that will yield the greatest performance gains.

We’re also looking to add memory insights based on the device you’re building for, so you can get platform-specific performance gains. This is in the early stages, and we’re actively looking for your feedback on this new feature, which you can provide on our roadmap page.

Resources

Expertise with Unity’s suite of profiling tools is one of the most useful skills you can add to your game development toolbox. That’s why we’re working on creating more advanced content about best practices to help you get the most out of our tools.

Several of my teammates recently put together our most extensive guide to date about profiling in Unity, in partnership with expert engineers from the Unity Integrated Success team and experts.

I also suggest you download these additional advanced e-books that offer extensive platform-specific optimization best practices:

Another handy reference is this flowchart, which provides a recommended approach to identifying bottlenecks in your project.

Flowchart that provides a recommended approach to identifying bottlenecks in your project.

Finally, this Profiling and optimization reading list, created by our content and marketing teams, includes key blog posts that will help you understand profiling concepts and methods, from basic to advanced.

Cover images for three Unity e-books: Optimize your game performance for consoles and PC, Optimize your mobile game performance, and Ultimate guide to profiling in Unity games.

Let us know what you think

My team is working hard to bring you the solutions you need for your most ambitious projects, and we’re always eager to understand how we can help you better. 

Stay tuned to updates in our public roadmap page. This is also the best place for you to share feedback directly with the product team. 

Watch the blog for our next Games Focus update, which will focus on what Unity is doing to help you target more platforms and form factors with your game content. And, as always, share your feedback with us on the forums.

September 28, 2022 in Engine & platform | 11 min. read

Is this article helpful for you?

Thank you for your feedback!

Related Posts