Note: The internal profiler is deprecated and will be retired in a future version of Unity. Use the Profiler window instead (menu: Window > Analysis > Profiler) Refer to Collecting performance data on an iOS device for more information on how to profile iOS devices.
Unity contains a built-in profilerA window that helps you to optimize your game. It shows 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. More info
See in Glossary for iOS to provide insight on how the application is running. Every 30 frames, the built-in profiler emits console messages from the application running on the device to help determine if it’s CPU or GPU-bound. If your application is CPU-bound, you can determine whether script code or garbage collection is causing the bottleneck.
Here’s an example of the built-in profiler’s output:
iPhone Unity internal profiler stats
frametime> min: 32.5 max: 34.1 avg: 33.3
cpu-player> min: 2.2 max: 4.4 avg: 3.7
batches> min: 3 max: 3 avg: 3
draw calls> min: 3 max: 3 avg: 3
tris> min: 1704 max: 1704 avg: 1704
verts> min: 5088 max: 5088 avg: 5088
dynamic batching> batched draw calls: 0 batches: 0 tris: 0 verts: 0
static batching> batched draw calls: 0 batches: 0 tris: 0 verts: 0
player-detail> physx: 0.0 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.0 render: 0.0 fixed-update-count: 0 .. 0
scripting-scripts> update: 0.0 fixedUpdate: 0.0 coroutines: 0.0
scripting-memory> information not available on non-development player configuration
All times are measured in milliseconds per frame. You can check the minimum, maximum, and average times over the last thirty frames.
Property | Function |
---|---|
cpu-player | Displays the time your app spends executing code inside the Unity engine and executing scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info See in Glossary on the CPU. |
cpu-ogles-drv (Android only) | Displays the time spent executing OpenGL ES driver code on the CPU. These driver stats can be affected by several factors, including the number of draw calls, number of internal rendering state changes, rendering pipeline setup, and number of processed vertices. |
cpu-present (Android only) | The amount of time spent executing the presentRenderbuffer command in OpenGL ES. |
frametime | Represents the overall time of an app frame. Note that iOS hardware is locked at a 60Hz refresh rate, so this property will always return a time that’s a multiple of 16.7ms (1000ms/60Hz = 16.7ms). |
Property | Function |
---|---|
tris # | Total number of triangles sent for rendering. |
verts # | Total number of vertices sent for rendering. Keep this number under 10000 if your application uses only static geometry. If your application uses many instances of skinned geometry, this number should be much lower. |
dynamic/static batching | Number of draw-calls, triangles, and vertices that the engine automatically batched. Comparing these numbers with draw-call and triangle totals can give you an idea how well is your sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info See in Glossary prepared for batching. Share as many materials as possible among your objects to improve batching. |
The player-detail section provides a detailed breakdown of what’s happening inside the engine:
Property | Function |
---|---|
physx | Time spent on physics. |
animation | Time spent animating bones. |
culling | Time spent culling objects outside the cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info See in Glossary frustum. |
skinningThe process of binding bone joints to the vertices of a character’s mesh or ‘skin’. Performed with an external tool, such as Blender or Autodesk Maya. More info See in Glossary |
Time spent applying animations to skinned meshes. |
batching | Time spent batching geometry. Batching dynamic geometry is considerably more resource-intensive than batching static geometry. |
render | Time spent rendering visible objects. |
fixed-update-count | Minimum and maximum number of FixedUpdates executed during this frame. Too many FixedUpdates will deteriorate performance considerably. |
The scripting-scripts section provides a detailed breakdown of the time spent executing code in the Mono runtime:
Property | Function |
---|---|
update | Total time spent executing all Update() methods in scripts. |
fixedUpdate | Total time spent executing all FixedUpdate() methods in scripts. |
coroutines | Time spent inside script coroutines. |
The scripting-memory section gives you an idea of how memory is managed by the Mono garbage collector:
Property: | Function: |
---|---|
allocated heap | Total amount of memory available for allocations. A garbage collection triggers if the heap doesn’t have enough memory left for a given allocation. If this doesn’t free enough memory, the allocated heap will grow in size. |
used heap | The portion of the allocated heap which is currently used up by objects. Every time you create a new class instance (not a struct), this number grows until the next garbage collection. |
max number of collections | Number of garbage collection passes during the last 30 frames. |
collection total duration | Total time (in milliseconds) of all garbage collection passes that happened during the last 30 frames. |
On iOS, the internal profiler is disabled by default. To enable it, use either of the following processes.
To enable the internal profiler from inside the Xcode project, use the following steps:
InternalProfiler.h
file.#define ENABLE_INTERNAL_PROFILER 0
to
#define ENABLE_INTERNAL_PROFILER 1
To enable the internal profiler in Unity, use the following steps:
Note: Ensure that the Development BuildA development build includes debug symbols and enables the Profiler. More info
See in Glossary option is enabled from Build Settings when you build your application.
To display the output console, in Xcode select View > Debug Area > Activate Console and then run your project. Unity outputs statistics to the console window every 30 frames.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.