The fact that developers can use the Unity profiler for profiling their own code or certain pieces of code is very important. In order to display statistics information about some of your function or for some part of your code in the Unity profiler, you just need to include your code between two calls,
Profiler.EndSample. After that you can use the visual Unity profiler tool to search for bottlenecks and spikes in your code.
The profiler is only available in Unity Pro. In standalone games, the profiler can dump all profiling information using
To create your own tool, you can utilize the following Unity API calls: