Language: English
MonoDevelop
Log Files

Profiler (Pro only)

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

The Unity Profiler helps you to optimize your game. It reports for you how much time is spent in the various areas of your game. For example, it can report the percentage of time spent rendering, animating or in your game logic.

You can play your game in the Editor with Profiling on, and it will record performance data. The Profiler window then displays the data in a timeline, so you can see the frames or areas that spike (take more time) than others. By clicking anywhere in the timeline, the bottom section of the Profiler window will display detailed information for the selected frame.

Note that profiling has to instrument your code. This instrumentation has a small impact on the performance of your game. Typically this overhead is small enough to not affect the game framerate. When using profiling it is typical to consider only the ratio (or percentage) of time spent in certain areas. Also, to improve performance focus on those parts of the game that consume the most time. Compare profiling results before and after code changes and determine the improvements you measure. Sometimes changes you make to improve performance might have a negative effect on frame rate; unexpected consequences of code optimization should be expected.

See Also

Webplayer

For webplayer profiling, follow these steps:

  1. Check the Development Build checkbox in Unity’s Build Settings dialog and also open the Profiler window before starting the build.
  2. When the game is running in the webplayer, make sure that Release Channel is set to Development. Alt+right-click on the web player to open the release channel selection menu.
  3. Select OSXWebPlayer(YOURCOMPUTERNAME) or WindowsWebPlayer(YOURCOMPUTERNAME) as appropriate from the Profiler Window’s Active Profiler drop-down menu.

iOS

Remote profiling can be enabled on iOS devices by following these steps:

  1. Connect your iOS device to your WiFi network (local/adhoc WiFi network is used by profiler to send profiling data from device to the Unity Editor).
  2. Check “Autoconnect Profiler” checkbox in Unity’s build settings dialog.
  3. Attach your device to your Mac via cable and hit “Build & Run” in Unity Editor.
  4. When app launches on device open profiler window in Unity Editor (Window->Profiler).

If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall’s outbound rules - these are the ports used by Unity for remote profiling.

Note: Sometimes Unity Editor might not autoconnect to the device. In such cases profiler connection might be initiated from Profiler Window Active Profiler drop down menu by select appropriate device.

Android

Remote profiling can be enabled on Android devices through two different paths : WiFi or ADB.

For WiFi profiling, follow these steps:

  1. Make sure to disable Mobile Data on your Android device.
  2. Connect your Android device to your WiFi network.
  3. Check the “Autoconnect Profiler” checkbox in Unity’s build settings dialog.
  4. Attach your device to your Mac/PC via cable and hit “Build & Run” in Unity Editor.
  5. When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
  6. If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler Window Active Profiler drop down menu. Note: The Android device and host computer (running the Unity Editor) must both be on the same subnet for the device detection to work.

For ADB profiling, follow these steps:

  • Attach your device to your Mac/PC via cable and make sure ADB recognizes the device (i.e. it shows in adb devices list).
  • Check the “Development Build” checkbox in Unity’s build settings dialog, and hit “Build & Run”.
  • When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
  • Select the AndroidProfiler(ADB@127.0.0.1:54999) from the Profiler Window Active Profiler drop down menu. Note: The Unity editor will automatically create an adb tunnel for your application when you press “Build & Run”. If you want to profile another application or you restart the adb server you have to setup this tunnel manually. To do this, open a Terminal window / CMD prompt and enter adb forward tcp:54999 localabstract:Unityinsert bundle identifier here

Note: The entry in the drop down menu is only visible when the selected target is Android.

If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall’s outbound rules - these are the ports used by Unity for remote profiling.

MonoDevelop
Log Files