Skip to content

Commit

Permalink
Expose ProfilerScope as a public API
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed Nov 28, 2024
1 parent 29ac14a commit 44f4583
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Editor/ProfilerScope.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
using System;
#nullable enable

using System;
using JetBrains.Annotations;
using UnityEngine.Profiling;

namespace nadena.dev.ndmf
{
internal struct ProfilerScope : IDisposable
/// <summary>
/// Performs a `Profiler.BeginSample` call on construction, and `Profiler.EndSample` on disposal.
/// </summary>
[PublicAPI]
public struct ProfilerScope : IDisposable
{
public ProfilerScope(string name)
public ProfilerScope(string name, UnityEngine.Object? target = null)
{
Profiler.BeginSample(name);
Profiler.BeginSample(name, target);
}

public void Dispose()
Expand Down

0 comments on commit 44f4583

Please sign in to comment.