# TryConvertPropertyIDToName(int, out string)

> Returns whether the property ID is valid and outputs the corresponding property name if it exists.

## Definition

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

## TryConvertPropertyIDToName(int, string)

```csharp
public static bool TryConvertPropertyIDToName(int propertyID, out string name)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The ID of the shader property to get the name of. Use [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md) to get an ID.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The string into which the method writes the property name corresponding to the given ID, or an empty string if the ID is invalid.

### Returns

| Type                                                          | Description                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property ID is valid and the name was successfully retrieved, false otherwise. |

### Remarks

This method allows you to get the original property name using the ID of a shader property. Use the name only for debugging and introspection, because passing strings is slower than passing property IDs.

Property IDs that were not created with [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md) are considered invalid.

Compared to [Shader.PropertyIDToName](/engine/6000.6/script-reference/unityengine/shader/propertyidtoname.md), using this method avoids ambiguity with null or empty strings in the situation where the property ID is invalid.

Additional Resources: [Shader.PropertyIDToName](/engine/6000.6/script-reference/unityengine/shader/propertyidtoname.md), [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).

### Examples

```csharp
using UnityEngine;

public class TryConvertPropertyIDToNameExample : MonoBehaviour
{
    private void Start()
    {
        int propertyID = Shader.PropertyToID("_MainTex");
        // prints "_MainTex"
        if (Shader.TryConvertPropertyIDToName(propertyID, out string retrievedName1))
        {
            Debug.Log(retrievedName1); 
        }
        else
        {
            Debug.Log("Property ID does not exist.");
        }

        // prints "Property ID does not exist."
        int invalidId = 999999;
        if (Shader.TryConvertPropertyIDToName(invalidId, out string retrievedName2))
        {
            Debug.Log(retrievedName2); 
        }
        else
        {
            Debug.Log("Property ID does not exist.");
        }
    }
}
```
