docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ProfilerCounter<T>

    Reports a value of an integer or floating point type to the Unity Profiler.

    Namespace: Unity.Profiling
    Assembly: Unity.Profiling.Core.dll
    Syntax
    public readonly struct ProfilerCounter<T> where T : unmanaged
    Type Parameters
    Name Description
    T

    int, uint, long, ulong, float or double type.

    Constructors

    ProfilerCounter(ProfilerCategory, string, ProfilerMarkerDataUnit)

    Constructs a ProfilerCounter that is reported to the Unity Profiler whenever you call Sample().

    Declaration
    public ProfilerCounter(ProfilerCategory category, string name, ProfilerMarkerDataUnit dataUnit)
    Parameters
    Type Name Description
    ProfilerCategory category

    Profiler category.

    string name

    Name of ProfilerCounter.

    ProfilerMarkerDataUnit dataUnit

    Value unit type.

    Methods

    Sample(T)

    Sends the value to Unity Profiler immediately.

    Declaration
    [Conditional("ENABLE_PROFILER")]
    [Pure]
    public void Sample(T value)
    Parameters
    Type Name Description
    T value

    The value to send to the profiler.

    Remarks

    Does nothing in Release Players.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)