# EndSample

> Adds a command to end profile sampling.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Rendering](/engine/6000.5/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

## EndSample(string)

Adds a command to end profile sampling.

```csharp
public void EndSample(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Name of the profile information used for sampling.

### Remarks

Schedules a performance profiling sample to end when the Command Buffer reaches this point.

To begin a performance profiling sample, call [CommandBuffer.BeginSample](/engine/6000.5/script-reference/unityengine/rendering/commandbuffer/beginsample.md). At the and of the sample, call this method with the same argument as the BeginSample call.

## EndSample(CustomSampler)

Adds a command to end profile sampling.

```csharp
public void EndSample(CustomSampler sampler)
```

### Parameters

**** (\[CustomSampler]\(/engine/6000.5/script-reference/unityengine/profiling/customsampler)): The CustomSampler that the CommandBuffer uses for sampling.

### Remarks

Schedules a performance profiling sample to end when the Command Buffer reaches this point.

To begin a performance profiling sample, call [CommandBuffer.BeginSample](/engine/6000.5/script-reference/unityengine/rendering/commandbuffer/beginsample.md). At the and of the sample, call this method with the same argument as the BeginSample call.

## EndSample(ProfilerMarker)

Adds a command to end profile sampling.

```csharp
[Conditional("ENABLE_PROFILER")]
public void EndSample(ProfilerMarker marker)
```

### Parameters

**** (\[ProfilerMarker]\(/engine/6000.5/script-reference/unity/profiling/profilermarker)): The ProfilerMarker that the CommandBuffer uses for sampling.

### Remarks

Schedules a performance profiling sample to end when the Command Buffer reaches this point.

To begin a performance profiling sample, call [CommandBuffer.BeginSample](/engine/6000.5/script-reference/unityengine/rendering/commandbuffer/beginsample.md). At the and of the sample, call this method with the same argument as the BeginSample call.
