Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

ProfilerCounterDescriptor Constructor

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

Submission failed

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

Close

Cancel

Declaration

public ProfilerCounterDescriptor(string name, ProfilerCategory category);

Parameters

Parameter Description
name The name of the Profiler counter to describe.
category The category of the Profiler counter to describe. A Unity.Profiling.ProfilerCategory.

Description

Initializes and returns an instance of ProfilerCounterDescriptor.

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.


Declaration

public ProfilerCounterDescriptor(string name, string description, ProfilerCategory category);

Parameters

Parameter Description
name The name of the Profiler counter to describe.
description A human-readable description of the Profiler counter.
category The category of the Profiler counter to describe. A Unity.Profiling.ProfilerCategory.

Description

Initializes and returns an instance of ProfilerCounterDescriptor with a description.

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.


Declaration

public ProfilerCounterDescriptor(string name, string categoryName);

Parameters

Parameter Description
name The name of the Profiler counter to describe.
categoryName The category name of the Profiler counter to describe.

Description

Initializes and returns an instance of ProfilerCounterDescriptor.

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.


Declaration

public ProfilerCounterDescriptor(string name, string description, string categoryName);

Parameters

Parameter Description
name The name of the Profiler counter to describe.
description A human-readable description of the Profiler counter.
categoryName The category name of the Profiler counter to describe.

Description

Initializes and returns an instance of ProfilerCounterDescriptor with a description.

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.