Basic

September 28 2020

4 comments

Slow Unity Iteration Times? Ask Editor Iteration Profiler (IEP) Why

By Rubén Torres Bonet

September 28, 2020


__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"6c4de":{"name":"Main Accent","parent":-1},"67ed2":{"name":"Accent Dark","parent":"6c4de","lock":{"saturation":1}}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"6c4de":{"val":"var(--tcb-skin-color-0)"},"67ed2":{"val":"rgb(59, 65, 63)","hsl_parent_dependency":{"h":160,"l":-0.05,"s":0.04}}},"gradients":[]},"original":{"colors":{"6c4de":{"val":"rgb(51, 190, 127)","hsl":{"h":152,"s":0.57,"l":0.47}},"67ed2":{"val":"rgb(59, 65, 63)","hsl_parent_dependency":{"h":160,"s":0.04,"l":0.24}}},"gradients":[]}}]}__CONFIG_colors_palette__

Complex scenes, huge C# assemblies, expensive initialization in your scripts... All of them lead to slow iteration times in the Unity editor.

But why exactly is your editor so slow in your specific project at entering and exiting play mode?

And more importantly, how can you cut your iteration times every time you touch any of your C# scripts?

You don't need to take more blind guesses.

Instead, ask Unity Iteration Editor Profiler.

How to Waste Time — Iteration Times

You are coding a gameplay feature in C#.

You save, switch to the editor and wait 20 seconds due to compiling.

Now you enter play mode and wait another 20 seconds.

Oops, you realized you applied the physics force in the wrong axis.

Exit play mode and wait another 20 seconds.

You make your change in C# and start the iteration all over again.

You just wasted 60 seconds in this iteration.

That's probably enough for a short coffee break. But it isn't great if you aim to get your game on the store ASAP.

Ok, everybody deals with slow iteration times when projects evolve.

But barely anyone knows how to fight back this gamedev productivity killer.

So today I'm showing you a new toy that empowers you to spot who exactly is wasting your time during:

  • C# compilation iteration times.
  • Entering play mode.
  • Exiting play mode.

And this toy has a name: the Unity Editor Iteration Profiler.

Can You Help Me, Unity Editor Iteration Profiler (EIP)?

The Editor Iteration Profiler is a new tool that lets you identify and measure where your waiting times are going in your assembly reloads and play-mode operations.

This window will persist the performance metrics for the entire editor session, i.e. you won't lose them just like when you hit the sample count in the original profiler.

Before we move on, let's have a quick expectation-adjustment GIF:

Unity Editor Iteration Profiler EIP Sample

That's the type of output you can expect from this tool.

Still with me?

Let's see how to install it.

Installing the Unity Editor Iteration Profiler (EIP)

Just download the latest ZIP from the Unity EIP GitHub repository (shortcut here).

Then, extract its contents into your Packages folder.

That's it.

Expected something harder? The instructions would even fit in a tweet.

Spotting Productivity-Killers With Unity Editor Iteration Profiler

Let's get the Unity EIP to work in one of the projects I have lying around.

Just open the main Unity Editor Iteration Profiler panel by navigating to Windows → Analysis → Editor Iteration Profiler → Show Window.

Then enable recording, enter play mode and have a coffee break.

Perfect. The right time for a coffee break.

Here are the results.

Unity Editor Iteration Profiler EIP Results Total

8 seconds.

Not very useful, let's uncollapse that marker.

Unity Editor Iteration Profiler EIP Results Batching

Ok, now we're getting somewhere.

When loading the level, we are paying considerable time for combining vertices, indices and merging prefabs.

To me that sounds like preparing static batching.

So that's one of the iteration time costs we are paying for every time we hit play. Preparing the batches that come from static renderers.

But wait, there's more.

Unity Editor Iteration Profiler EIP Results ReloadAssembly

Reloading assemblies taking above 2 seconds. And backing up scenes took almost a second.

What a surprise (or not).

Actually, that was to be expected. Especially if you read about Domain Reloading and the optimizations you have available to fight these slow downs.

It's great to have this information.

Sure, it doesn't mean you can always do something about it. But most of the times you'll manage to squeeze a few seconds out of these iteration times.

And a few seconds aggregate to minutes each day. And to hours each month.

These wasted minutes might well be the difference between calmly going to sleep after closing a ticket... or having nightmares because of the cognitive load an open ticket put on you.

What's Next?

These are just the basics: finding where you are wasting your time. There's much more to this tool, so visit the official documentation to explore all the options.

That's only the first step, of course.

The second part is all about you fighting the time-robbers this tool uncovered for you.

If you want to learn more performance optimization tricks, check out my Unity Performance 100+ Checklist.

~Ruben

  • How did I not hear about this tool? I have been using 30-second compile + 30-second scene loading times for a while now, and assemblies didn’t seem to do much. This is exactly what I need.
    Thank you.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Rubén Torres Bonet

    About the author

    Born Game Developer, now ready to help you develop better games. Primary programmer on Star Trek Bridge Crew (Oculus Quest), Diamond Dash. Programmer on Time Stall, Catan Universe, Anne Frank House VR, Jelly Splash, Blackguards Definitive Edition. I also worked in minor XR experiences for HoloLens and Vive for clients such as Audi and Volkswagen.

    You might also like

    >