Unity Profiler Tool

I had a look at the CPU profiler in Unity today as prep for my new job. Below is a super quick overview of the tool.

To open the profiler, go to Window > Profiler. This opens a new window showing a timeline of frames and a list of functions for each frame.


To view the current frame, click the current button in the top right. To view a specific frame, click on it in the graph. This will pause the game and give you information for that frame. The total ms cost for the frame is shown in the middle of the window. The lines on the graph show some target ms costs such as 33 and 16.


The list of functions allow us to see the time in ms for each function, as well as the percentage of the total frame time that that function uses. The self version of these shows the cost of the function without its children. The calls column shows how many calls to that function happen in the frame.

GC alloc shows how much garbage collection happens for that resource. Garbage is memory set aside to store data that is no longer in use – GC refers to the process that frees up this memory for use. If this happens too often it can hit performance, so worth keeping an eye on.

To get more information on child functions, we can run deep profiling by using the button next to record at the top of the window. Below, I’ve ran it to get more information on culling. Without deep profiling, I could see that this cost was related to culling lights, but with it on, I can see that its specifically linked to single directional shadows (common sense should have told me that lighting culling cost was associated with shadow casting, but data is always good!).


The profiler has a bit of an overhead – so make sure that you use the statics view with the profiler off to get the actual fps and ms per frame cost before profiling. Any logging functions that you may be using are part of debugging will also be fairly heavy. 3


On Finishing Things

So this post is a little different from my normal writing. Its not technical, its personal. So if you’re not here for gross feelings-y things, look away now!

I haven’t updated my portfolio in over a year. I haven’t finished a project that is more than 12 hours long in about 4 years. That’s how long I’ve been working in the games industry.

Its hard to work on personal stuff when you’ve tired from working all day, when you have to think about adult responsibilities and when you are no longer motivated by fear of failure. Until two months ago, I had a secure job with a permanent contract. The fear that motivated me during university had totally disappeared. I handed in my notice and will be going back to a fixed term contract next month to do something a bit different, but the additions to my folio that helped me with that all came from my current job.

I live with the constant feeling that I don’t know how to do my job, that I’m going to be exposed as a fraud, that I need to learn so much more so I can be as good as that environment artist and that programmer combined. Most people I’ve spoken to feel this way, but I seem to let it affect me more than some of my peers. Rather than pushing me to focus, dedicate myself and learn so I can get better, it makes me flighty – one week I need to learn a new normal map baking technique, then next I need to learn C#. In the end, it feels like I have surface level knowledge of a lot of things, but absolutely no depth. This turns into a cycle, as the lack of depth fuels the feeling that I don’t really know what I’m talking about. The obvious answer is pick one thing and focus, but I get maybe halfway though a project, think its awful, have another idea, say I’ll go back to the old one, and never do. The last 10% is the hardest, and without pushing yourself through it, it doesn’t get done. So I tell myself, this is personal, you have work to stress about, you don’t need this. And I don’t do anything at all.

This is all frustrating, because I’ve come from a background of being a very dedicated, stubborn and obsessive person. I still am in many parts of my life, but since game development became my job it hasn’t been the same. In Uni, I worked 16 hour days. I did game jams and game development society on top of my course work. I went from pretty hopeless to getting a professional tech art job where I’ve progressed fairly fast. That wasn’t healthy – I put on almost 4 stone because I wouldn’t even afford myself time to cook real food and I don’t think it did any good for my already poor mental health.

I don’t want to go back there, but I do miss the immersion in a game dev community, this feeling that everyone wanted to create and get better. The jealousy and rivalries sucked, but they were used in a positive way. Comparison to others in a professional sphere just seems to defeat me.

I had a similar experience with obsession in high school, albeit more positive. I drew every day. I aimed to complete one digital painting per week, and always met that. Every time I completed something, I printed it out, stuck it in my binder of paintings and compared it to my last piece. I saw how I’d improved and felt proud. I rarely feel proud of my work now – I’m paid to do it, of course I should be able to. In fact, why did I learn this technique just now, and not last year?

So safe to say I don’t have a positive or healthy relationship with my work just now – both personal and professional. However, something entirely different has sparked my determination to fix it. Last month I told my D&D group that I’d DM a custom one-shot for a weekend where they had planned to come up to my house. I figured this would take me maybe 10 hours tops to prepare. It took 50, during a month where I had to rush home to my family (at least a day’s travel away) on two occasions due to some very sad events. I was preoccupied, busy and upset, yet I finished this project with no problems. After finishing it, I questioned why I’d: A – just spent a month on D&D when I should be learning Unity for my new job, and B – I could finish a project that size – what was the difference between that and something game development related?

After pondering that one, there’s a couple of key takeaways that I’d like to bring forward into my personal game dev practice.

Having a deadline. 

Because I said I’d DM next week, I had a deadline that I couldn’t push or give up on – I’d be letting others down. Having this deadline forced me to focus, to finish and to ignore other ideas that popped into my head.

Having a clear MVP and an understanding of which things to drop to meet my deadline. 

I knew the minimum that I’d need to be able to run the game, and all though I thought making detailed, painterly maps would be cool, I just didn’t have time. My flat shaded blocks work fine though, and don’t look half bad!

Having an audience, and a purpose.

I had a reason to do this, and I knew that its purpose was so that my friends could have some fun. I think I lack distinction between folio pieces, learning new skills and solving problems, and so being more clear on the reason for a particular project will keep me motivated.

Not comparing or presuming work should meet certain standards.

As this had nothing to do with my job, I had no standards. I wanted it to be good, but was proud just for doing it. I miss this feeling so much! I think I need a little humility about the level I’m starting at, and to cut myself some slack. Make finishing the goal, not making something perfect. Sure, I can make something better at work – that’s because I have 40 hours a week and an entire team supporting me!

Having a clear end point, including a physical product.

Holding the map boards in my hand was a great feeling – I’d made that! It was similar to when I’d flip through my binders as a teenager. Its a difficult one with game dev – there’s not going to be a final product – but I think the act of adding it to my folio, rather than dumping it on here, may be comparable.

Overall, I’d like to go into whatever I work on next:

  • With a realistic deadline
  • With a clear goal that involves something I can put on my portfolio
  • With an MVP that doesn’t shift
  • And with a kinder attitude towards myself