Measure It!

Measure It! is a small C# script we use while developing in Unity. It stores various statistics and displays them on screen whether in playmode or in editor. This is especially useful for Unity Indie users who don't have access to the profiler of the Pro version.
Features
- Measure execution times in various units (Ticks, Milliseconds, Seconds) and show Min/Max/Average values
- Display variables and custom text
- Counting
- Console logging
- Toggle output using debug groups
Download & Installation
| File | Description | Date |
|---|---|---|
| Measure It 1.09.unitypackage | Plugin package | 06/06/2011 |
| MeasureItDemo.unitypackage | Demo scene | 06/06/2011 |
Just import the package into your project. If you don't attach the component to a GameObject, a new GameObject will be created on first use.
Basic Usage
Measure It! stores information in slots. A case-sensitive string (slotName) is used to create and refer to slots and to display slot's values.
Profiling example
MeasureIt.Begin("Calculation time");
//do some stuff
Measureit.End("Calculation time");
Counting example
MeasureIt.Count("Clicks");
Displaying custom text example
MeasureIt.Set("Current event",Event.current);
Clear a slot
MeasureIt.Clear("Click"); // clear a single slot
MeasureIt.Clear(); // clear all slots
Console Log
MeasureIt.Log("Hello world","aCustomDebugGroup"); // only shown if aCustomDebugGroup isn't muted!
Working with Groups
MeasureIt.MuteGroup("aCustomDebugGroup"); // mute all debug output for aCustomDebugGroup
MeasureIt.UnMuteAllGroups(); // Clear list of muted ObjectsLogging
Logging in Measure It! works similar to the built-in Debug.Log (and of course LogWarning, LogError). So where's the clue? Well, starting with v1.07 we added...
Groups
Almost all methods of Measure It! now accept an optional string to sort information into groups. This allows you to mute whole groups by simply adding it's names to a list. Consider the following real-world scenario:
You need to find a nasty bug involving editor-scripts and a lot of Unity Callbacks. So what do you do? You add something like Debug.Log("Awake "+name) and Debug.Log("OnEnable "+name) to tons of functions to see what's going on and hunt down this bug... gratz, finally you've got it. You've also got a spamming Console window now. So, go through all functions again and either comment or delete those lines. Until the next bug needs those Debuglogs again...
We've gone through this procedure several times the last days and decided that this is anything but fun. So Measure It! now supports groups:
In our code we replaced calls like e.g. Debug.Log("Awake "+name) with MeasureIt.Log("Awake "+name, "UnityCallbacks") and told the Measure It! object to mute anything belonging to "UnityCallbacks". What a silence! Whenever we need to see those debug stuff again, we just have to remove the entry in the Measure It! object and we're done. What a simple feature, what a major time saver!