What is Unity’s Profiler?
Put simply, Profile is a tool for Unity3D Pro that allows game developers to see, in detail, what aspects of their video game are utilizing how many, and which, system resources. So you can get a visual display of uses, such as CPU, memory, and the time each task takes to process.
I’ve Started to Use, and Benefit From Profiler
Up until the last few days, I haven’t really looked into the Profiler. At first glance, it’s a little intimidating with the multitude of scripts and functions that you can drill down into. You can literally see which scripts or functions are taking the most time to process, or eating up the most processing power, or using the most memory. But once I got over the initial learning curve, it has turned out to be a very useful, more than that, essential, tool.
Over the weekend I discovered that one of my sound effects was taking 2.48ms to process, which seemed longer than necessary. David Helgason, Founder and CEO of Unity Technologies responded to a Twitter post I made on the subject. Once I went through and used an uncompressed audio file, processing time got cut down to about 0.03ms.
It’s not just that though. I’ve come across quite a few inefficient pieces of source code that I have written over the past year. Usually with external source or variable calls, other gameObject calls, instantiations of PreFabs, or over-sized loops in the Update() functions. Profiler makes it possible to find these potentially problematic code snippets or procedures with relative ease.
During the process, I have discovered that Ben Throop’s Detonator framework is a little inefficient with the way that it starts up explosions. So next up I’ll be trying to create some of my own nice and clean explosions.