ProfilerCounterDescriptor
Initializes and returns an instance of ProfilerCounterDescriptor.
Read time 4 minutesLast updated 14 days ago
Definition
- Type: Constructor
- Namespace: Unity.Profiling.Editor
- Assembly: UnityEditor.CoreModule
ProfilerCounterDescriptor(string, ProfilerCategory)
Initializes and returns an instance of ProfilerCounterDescriptor.
public ProfilerCounterDescriptor(string name, ProfilerCategory category)
Parameters
The name of the Profiler counter to describe.
The category of the Profiler counter to describe. A ProfilerCategory.
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[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) {}}
Additional Resources: ProfilerModule.
ProfilerCounterDescriptor(string, string, ProfilerCategory)
Initializes and returns an instance of ProfilerCounterDescriptor with a description.
public ProfilerCounterDescriptor(string name, string description, ProfilerCategory category)
Parameters
The name of the Profiler counter to describe.
A human-readable description of the Profiler counter.
The category of the Profiler counter to describe. A ProfilerCategory.
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[ProfilerModuleMetadata("Custom Profiler Module")]public class CustomProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor( "Active Entities", "Number of active entities in the current scene", ProfilerCategory.Scripts ), new ProfilerCounterDescriptor( "Physics Queries", "Number of physics queries performed this frame", ProfilerCategory.Physics ), }; public CustomProfilerModule() : base(k_ChartCounters) {}}
Additional Resources: ProfilerModule.
ProfilerCounterDescriptor(string, string)
Initializes and returns an instance of ProfilerCounterDescriptor.
public ProfilerCounterDescriptor(string name, string categoryName)
Parameters
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[ProfilerModuleMetadata("Garbage Collection")]public class GarbageCollectionProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor("GC Reserved Memory", ProfilerCategory.Memory.Name), new ProfilerCounterDescriptor("GC Used Memory", ProfilerCategory.Memory.Name), new ProfilerCounterDescriptor("GC Allocated In Frame", ProfilerCategory.Memory.Name), }; public GarbageCollectionProfilerModule() : base(k_ChartCounters) {}}
Use this constructor when you need to specify the category by name as a string.
Additional Resources: ProfilerModule.
ProfilerCounterDescriptor(string, string, string)
Initializes and returns an instance of ProfilerCounterDescriptor with a description.
public ProfilerCounterDescriptor(string name, string description, string categoryName)
Parameters
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[ProfilerModuleMetadata("Network Statistics")]public class NetworkProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor( "Network Packets Sent", "Total number of network packets sent this frame", "Network" ), new ProfilerCounterDescriptor( "Network Packets Received", "Total number of network packets received this frame", "Network" ), }; public NetworkProfilerModule() : base(k_ChartCounters) {}}
Use this constructor when you need to specify both a description and the category by name as a string.
Additional Resources: ProfilerModule.
ProfilerCounterDescriptor(string, ProfilerCategory, string)
Initializes and returns an instance of ProfilerCounterDescriptor with a different display name.
public ProfilerCounterDescriptor(string name, ProfilerCategory category, string displayName)
Parameters
The name of the Profiler counter to describe.
The category of the Profiler counter to describe, which must be a ProfilerCategory.
The name to display in the Profiler module.
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[ProfilerModuleMetadata("2D Tilemap")]public class TilemapProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor("Tilemaps rendered", ProfilerCategory.U2D, "Total Tilemap Rendered"), new ProfilerCounterDescriptor("Tilemap Chunks rendered", ProfilerCategory.U2D, "Chunks Rendered"), new ProfilerCounterDescriptor("Tilemap Meshes rendered", ProfilerCategory.U2D, "Meshes Rendered"), }; public TilemapProfilerModule() : base(k_ChartCounters) {}}
Use this constructor to specify a different name to display in the Profiler module.
Additional Resources: ProfilerModule.
ProfilerCounterDescriptor(string, string, ProfilerCategory, string)
Initializes and returns an instance of ProfilerCounterDescriptor with a different display name and description.
public ProfilerCounterDescriptor(string name, string description, ProfilerCategory category, string displayName)
Parameters
The name of the Profiler counter to describe.
A description of the Profiler counter.
The category of the Profiler counter to describe. A ProfilerCategory.
The name to display in the Profiler module.
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[ProfilerModuleMetadata("2D Tilemap")]public class TilemapProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor( "Tilemaps rendered", "Shows the number of Tilemaps rendered", ProfilerCategory.U2D, "Total Tilemap Rendered" ) }; public TilemapProfilerModule() : base(k_ChartCounters) {}}
Use this constructor to specify a different name and description to display in the Profiler module.
Additional Resources: ProfilerModule.
ProfilerCounterDescriptor(string, string, string, string)
Initializes and returns an instance of ProfilerCounterDescriptor with a different display name and description.
public ProfilerCounterDescriptor(string name, string description, string categoryName, string displayName)
Parameters
Remarks
using System;using Unity.Profiling;using Unity.Profiling.Editor;[ProfilerModuleMetadata("2D Tilemap")]public class TilemapProfilerModule : ProfilerModule{ static readonly ProfilerCounterDescriptor[] k_ChartCounters = new ProfilerCounterDescriptor[] { new ProfilerCounterDescriptor( "Tilemaps rendered", "Shows the number of Tilemaps rendered", "U2D", "Total Tilemap Rendered" ) }; public TilemapProfilerModule() : base(k_ChartCounters) {}}
Use this constructor to specify a different name to display in the Profiler module and specify the category as a string with description.
Additional Resources: ProfilerModule.