Legacy Documentation: Version 5.2
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Profiler

class in UnityEngine

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

Switch to Manual

Description

Controls the Profiler from script.

You can add custom Profiler sections in your scripts with Profiler.BeginSample and Profiler.EndSample.

In standalone games, Profiler can dump all profiling information using Profiler.logFile and Profiler.enabled.

Static Variables

enableBinaryLogSets profiler output file in built players.
enabledEnables the Profiler.
logFileSets profiler output file in built players.
maxNumberOfSamplesPerFrameResize the profiler sample buffers to allow the desired amount of samples per thread.
usedHeapSizeHeap size used by the program.

Static Functions

AddFramesFromFileDisplays the recorded profiledata in the profiler.
BeginSampleBegin profiling a piece of code with a custom label.
EndSampleEnd profiling a piece of code with a custom label.
GetMonoHeapSizeReturns the size of the mono heap.
GetMonoUsedSizeReturns the used size from mono.
GetRuntimeMemorySizeReturns the runtime memory usage of the resource.