DEV Community

Attilio Carotenuto
Attilio Carotenuto

Posted on • Edited on

Unity Project analysis with the Project Auditor

The Project Auditor is a static analysis tool that goes through your project to provide useful statistics, identify potential improvements, and compile a list of recommendations with just a single button click.

It is a fairly recent package, made publicly available in February 2025. For this reason, not many developers are aware of it and using it.

Let’s see what features the Auditor offers, and how it can help make your games run faster, as well as improving your development experience within Unity.

For this tutorial, I will be using Unity 6000.0.44. Some settings and features might differ if you use a different version of the engine.

Setting up the Auditor

In order to start using the Auditor, open the Package Manager and install the package via name, using com.unity.project-auditor. The current version is 1.0.1.

Then, open it from Window > Analysis > Project Auditor and press Start Analysis.

Image description

By default, the Project Auditor will cover all available areas, including Code, Project Settings, Assets, Shaders, and Build. You can tweak that in Preferences > Analysis > Project Auditor, as shown below.

Image description

Depending on the project size and the amount of assets and code, the analysis might take some time to complete. When ready, the main window will show a summary of the results.

Image description

Each listed issue has a priority attached, from Major to Minor, as shown above. The summary will also conveniently show a list of the ten most significant issues in your project, those are normally the ones you want to tackle first.

On the top left, the Auditor will show the Platform that was set when the Analysis was executed. If you decide to switch the active platform you’ll need to run a new analysis.

Analyses are not automatically saved and will be discarded if you start a new one. To preserve the results, press the Save button on the top right corner of the window, which will generate a .projectauditor file.

Image description

You can then reload it by using the Load button next to it.

Improving your Code performance

The Code section will offer various recommendations to improve the performance of your code, reducing allocations, boxing allocations, expensive method calls, and a lot more.

Image description

You can select individual entries, and the Auditor will show details about the issue, as well as any eventual recommendations to fix it. You can also inspect the Inverted Call Hierarchy at the bottom, allowing you to quickly navigate to the portion of code related to the issue reported.

In some cases you might want to ignore a Code issue, possibly because fixing it would require significant structural changes, or because it’s actually doing what you intended (such as explicitly allocating). In that case, you can press the Ignore Issue button and it will be hidden.

Tackling Domain Reloads

Recent versions of Unity allow you to disable Domain reloads. This significantly speeds up your iteration times, but can lead to unintended issues. For example, static variables will keep their value between sessions, static events will keep their subscribers, and non-serialized fields will preserve the values set during Play mode. In order to take advantage of this, we need to write code that correctly handles state resets.

You can use the Project Auditor to analyse your code and find domain reload issues. To do so, first make sure the feature is enabled in Preferences > Analysis > Project Auditor > Use Roslyn Analyzers.

Image description

Then, run an analysis, and within the Code section, navigate to the Domain Reload sub-section.

Image description

The Auditor will provide a list of issues, along with recommendations to make the code compliant. Fixing these in most cases is fairly trivial.

When you’re done, you can disable domain reloads by going to Edit > Project Settings > Editor > When entering Play Mode, and setting it to “Do not reload Domain or Scene”. Developing your game will be much faster and pleasant as a result.

Optimising your Assets

The Assets Section offers an overview of the assets contained within your project, specifically Textures, Sprite Atlases, Meshes, Audio Clips, and various animation assets.

In the Asset Issues sub-section, you’ll receive recommendations regarding Asset Import Settings, as well as warnings related to usage of the Resources folder and other best practices.

Image description

As with the Code section, the Auditor will show additional details and recommendations on the right panel. At the bottom it will give a quick overview of the related Asset dependencies.

Analysing Shaders and Shader Variants

In the Shaders section you can get a quick overview of the Shaders and Materials contained in your project.

For each Shader, the Auditor will report some useful stats such as the Number of Passes, Keywords, Properties and Texture Properties defined, and the Max amount of Variants generated from that shader. It will also show whether the shader supports GPU instancing and if it is compatible with the SRP Batcher.

Image description

If you already made a build, the Shaders view will show the amount of Built Fragment Variants for each shader.

This table might not be updated if the shaders included in the latest build were already in the shader cache. If that happens, make sure to do a Clean Build and refresh the window.

Switching to the Shader Variants view allows you to check all the variants included in your build, and which ones are compiled at runtime. In order to do that, you need to make a development build beforehand, ensuring that Log Shader Compilation is enabled in Project Settings > Graphics > Shader Loading (or directly from this view).

Image description

You then need to run the game and move around the world, in order to trigger the relevant shader compilations. Then, you can retrieve the Player.log and drag it onto the Shader Variants view. The Compiled field will then be populated based on the info from the log file.

You can learn more about this here, in the “Determining which variants are used at runtime” section.

Optimising your Project settings

The Project section gives you a quick overview of the packages included in your project, as well as a list of recommendations to optimise your Project Settings.

Image description

As shown in the screenshot, the Auditor will cover multiple areas, including Quality Settings, Time, Physics, Graphics and so on, as well as highlighting what platform is affected by the potential issue.

Producing faster and smaller Builds

The Build section shows useful information about the latest build you made.

In the Build Size sub-section, you can find useful information about the assets included in your build. Here, the Auditor gives you a breakdown of the 10 largest asset types.

Image description

Size of Data refers to the total uncompressed size of all assets included in your build.

Below that, you can find an overview of all the assets and scripts contained in your game build, as well as their size, and in which build file they’re actually included.

Image description

The Build Steps sub-section shows all the individual steps that were taken to create the latest build, as well as individual timings for each step. This is very helpful when dealing with long build times, allowing you to pinpoint exactly which steps are taking too long and apply the necessary optimisations. In the Information section above you can see the total time it took to complete the build, and its size.

Image description

Finally, going back to the Code section, the Assemblies sub-section provides a quick overview of Compile Time for each assembly, as well as their dependencies. This lets you identify which areas of your code are taking the longest to compile, so you can optimise it by reducing dependencies or breaking it into smaller assemblies.

Top comments (0)