docs.unity3d.com
    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();
    }

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: UnityEngine.XR.ARSubsystems
    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.

    UnityEngine.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.Dispose()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023