# BeginTrace()

> Start tracing shader variants and graphics states encountered at runtime.

## Definition

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

```csharp
public bool BeginTrace()
```

### Returns

| Type                                                          | Description                                                    |
| ------------------------------------------------------------- | -------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if tracing successfully started, false otherwise. |

### Remarks

Graphics states will only be traced when [SystemInfo.supportsParallelPSOCreation](/engine/6000.0/script-reference/unityengine/systeminfo/supportsparallelpsocreation.md) is true.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Experimental.Rendering;

public class BeginTraceExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        graphicsStateCollection = new GraphicsStateCollection();
        graphicsStateCollection.BeginTrace();
    }

    void OnDestroy()
    {
        graphicsStateCollection.EndTrace();
    }
}
```
