Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ProfilerModule(ProfilerCounterDescriptor[], ProfilerModuleChartType, string[])

Initializes and returns an instance of ProfilerModule.
Read time 1 minuteLast updated 6 days ago

Definition

protected ProfilerModule(ProfilerCounterDescriptor[] chartCounters, ProfilerModuleChartType defaultChartType = ProfilerModuleChartType.Line, string[] autoEnabledCategoryNames = null)

Parameters

The chart counters to display in the Profiler module’s chart. An array of ProfilerCounterDescriptor objects. The range is zero through 10.

defaultChartType

The chart style to use for the Profiler module’s chart. A ProfilerModuleChartType. The default value is ProfilerModuleChartType.Line.

autoEnabledCategoryNames

The names of all the Profiler categories to capture in the Profiler data stream when the module is active in the Profiler window. An array of string objects. The default value is null. When the value is null, Unity populates this list with all categories specified in the chartCounters parameter. Use this parameter if you want to capture additional categories in a module, that aren't specified in its chartCounters parameter, such as a module that uses counters from categories that aren't present in its chart to draw a custom Details View.

Remarks

The base ProfilerModule constructor must be invoked from a derived module type’s constructor.
using System;using Unity.Profiling;using Unity.Profiling.Editor;[Serializable][ProfilerModuleMetadata("Garbage Collection")]public class GarbageCollectionProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor("GC Reserved Memory", ProfilerCategory.Memory), new ProfilerCounterDescriptor("GC Used Memory", ProfilerCategory.Memory), new ProfilerCounterDescriptor("GC Allocated In Frame", ProfilerCategory.Memory), }; public GarbageCollectionProfilerModule() : base(k_ChartCounters) { }}