docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ScopedProfiler

    An IDisposable profiler object that will begin a profiler sample on instantiation and end the same when disposed.

    Example:

    using (new ScopedProfiler("MySample"))
    {
        CodeToProfile();
    }
    Implements
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public struct ScopedProfiler : IDisposable

    Constructors

    ScopedProfiler(string)

    Begins a new profiler sample. Same as Profiler.BeginSample.

    Declaration
    public ScopedProfiler(string name)
    Parameters
    Type Name Description
    string name

    A string to identify the sample in the Profiler window.

    ScopedProfiler(string, Object)

    Begins a new profiler sample. Same as Profiler.BeginSample.

    Declaration
    public ScopedProfiler(string name, Object targetObject)
    Parameters
    Type Name Description
    string name

    A string to identify the sample in the Profiler window.

    Object targetObject

    An object that provides context to the sample.

    Methods

    Dispose()

    Ends the current profiling sample. Same as Profiler.EndSample.

    Declaration
    public void Dispose()

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2024 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)