# TryGetUploadData(uint, out UploadData)

> Fetches the VariantsUploadedToGpuLastFrame.UploadData for the shader variant at given index.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Shaders](/engine/6000.6/script-reference/unityengine/shaders.md)
* **Assembly:** UnityEngine.CoreModule

## TryGetUploadData(uint, UploadData)

```csharp
public static bool TryGetUploadData(uint index, out VariantsUploadedToGpuLastFrame.UploadData uploadData)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The index of the shader variant in the data uploaded to the GPU driver.**** (\[UploadData]\(/engine/6000.6/script-reference/unityengine/shaders/variantsuploadedtogpulastframe/uploaddata)): The upload data struct to fill with the fetched data.

### Returns

| Type                                                          | Description                                                  |
| ------------------------------------------------------------- | ------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `True` if the shader variant data at the given index exists. |

### Remarks

Use this method to get information about the shader variant with index `index` uploaded to the GPU driver during the last frame. Unlike [VariantsUploadedToGpuLastFrame.GetUploadData](/engine/6000.6/script-reference/unityengine/shaders/variantsuploadedtogpulastframe/getuploaddata.md), does not throw exceptions.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Shaders;

/*
    Attach this script to a GameObect. When run in the player, it reports shader variants sent to the
    GPU driver for compilation during the last frame in the console.
*/
public class VariantsUploadedToGpuLogger : MonoBehaviour
{
    void Update()
    {
        uint variantCount = VariantsUploadedToGpuLastFrame.count;
        if (variantCount > 0)
        {
            Debug.Log("Sent " + variantCount + " variants to the GPU.");
            for (uint variantIndex = 0; variantIndex < variantCount; ++variantIndex)
            {
                VariantsUploadedToGpuLastFrame.UploadData d;
                if (!VariantsUploadedToGpuLastFrame.TryGetUploadData(variantIndex, out d))
                    continue;

                string keywords = "'";
                for (uint keywordIndex = 0; keywordIndex < d.keywords.Length; ++keywordIndex)
                {
                    if (keywordIndex != 0)
                        keywords += " ";
                    keywords += d.keywords[keywordIndex].name;
                }
                keywords += "'";
                string passId = "subshader " + (d.passIdentifier.SubshaderIndex + 1) + " pass " + (d.passIdentifier.PassIndex + 1);
                string description = "Shader " + d.shader.name + " " + passId + " stages " + d.stages;
                Debug.Log(description + " keywords " + keywords + " uploaded in " + d.uploadTimeInMilliseconds + " ms.");
            }
        }
    }
}
```
