unity3d Profiler Markup


Example

Using the Profiler Class

One very good practice is to use Profiler.BeginSample and Profiler.EndSample because it will have its own entry in the Profiler Window.

Also, those tag will be stripped out on non-Development build using using ConditionalAttribute, so you don't need to remove them from your code.

public class SomeClass : MonoBehaviour 
{
    void SomeFunction() 
    {
        Profiler.BeginSample("SomeClass.SomeFunction");
        // Various call made here
        Profiler.EndSample();
    }
}

This will create an Entry "SomeClass.SomeFunction" in the Profiler Window that will allow easier debugging and identification of Bottle neck.