The Unity Profiler, Using it to clean up a game.

It has been a bit since my last post however I have some good stuff to show everyone in the next few posts. First however I want to go over the Unity Profiler.

Although I will not go into a super amount of detail but I think it is good to go over this, especially for myself.

The Profiler can be enabled through the window menu and what will you see?

The profiler menu can be really scary at first, however reading it isn’t too bad once we take a look at what it actually is showing. The first thing however is to first set the bottom left overview from Timeline to Hierarchy so we can actually read what we are looking at.

In this window I have disabled everything except for scripts and through this I can see how many resources are being used to run this game. Although it only shows in reality a few seconds at a time, it can be extremely useful by watching out for any spikes in frame rates so that we can get to the bottom of optimizing our game.

When paused we can scrub through to see the details of any spot currently recorded. One thing to note is that “EditorLoop” is showing that the Unity Editor is taking up quite a bit of resources, and unfortunately that will always be the case. BUT we can look out for certain other things to optimize our game.

For example in our player loop, the Camera.Render is taking up the most so the us take a look. By opening it up we can see a break down of EVERYTHING that may be eating up resources and a big thing to look out for is our GC allocation. GC Allocation is basically the memory usage concerning any Garbage Collection. One easy way to spot problems is when you see too high of a GC Alloc going on during spikes. In this case, the frames have been steady and the GC Alloc has been low, if we started to see a GC Alloc of around 30KB or more… now then we would have a problem.

I’ve got something big to show everyone in a few posts! See you next post!