# Auto()

> Creates a helper struct for the scoped using blocks.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Profiling](/engine/6000.5/script-reference/unity/profiling.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public ProfilerMarker.AutoScope Auto()
```

### Returns

| Type                                                                                     | Description                                                                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AutoScope](/engine/6000.5/script-reference/unity/profiling/profilermarker/autoscope.md) | IDisposable struct which calls [ProfilerMarker.Begin](/engine/6000.5/script-reference/unity/profiling/profilermarker/begin.md) and [ProfilerMarker.End](/engine/6000.5/script-reference/unity/profiling/profilermarker/end.md) automatically. |

### Remarks

[ProfilerMarker.Begin](/engine/6000.5/script-reference/unity/profiling/profilermarker/begin.md) is called in the constructor and [ProfilerMarker.End](/engine/6000.5/script-reference/unity/profiling/profilermarker/end.md) in the *Dispose* method.

**Note:** [ProfilerMarker.Auto](/engine/6000.5/script-reference/unity/profiling/profilermarker/auto.md) is thread safe and can be used in jobified code.

### Examples

```csharp
using Unity.Profiling;

public class MySystemClass
{
    static ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker("MySystem.Simulate");

    public void UpdateLogic()
    {
        using (s_SimulatePerfMarker.Auto())
        {
            // ...
        }
    }
}
```
