O'Reilly logo

Unity 5 for Android Essentials by Valera Cogut

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The scriptable profiler tool

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.BeginSample and Profiler.EndSample. After that you can use the visual Unity profiler tool to search for bottlenecks and spikes in your code.

Note

The profiler is only available in Unity Pro. In standalone games, the profiler can dump all profiling information using Profiler.log and Profiler.enabled.

To create your own tool, you can utilize the following Unity API calls:

  • FindObjectsOfTypeAll
  • FindObjectsOfType
  • GetRuntimeMemorySize ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required