# ValidateDefines(string[], out string)

> Validates the given array of constant defines.

## Definition

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

## ValidateDefines(string\[], string)

```csharp
public static bool ValidateDefines(string[] defines, out string msg)
```

### Parameters

**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): The constant define array to validate.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The error message if validation errors occur.

### Returns

| Type                                                          | Description                                                 |
| ------------------------------------------------------------- | ----------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the constant define data is valid, otherwise false. |

### Remarks

This method checks that the define array does not contain multiple entries with the same identifier. It also runs data validation on each element individually.

### Examples

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


public class DefineValidationExample
{
    void ValidateDefines()
    {
        string[] defineArray = new string[] { "MAX_NUM_LIGHTS 8", "EPSILON 0.1f" };

        // Check if the define array is valid. This will catch both duplicates and invalid individual defines.
        string validationErrors;
        if (!ShaderBuildSettings.ValidateDefines(defineArray, out validationErrors))
        { 
            Debug.LogWarning(validationErrors);
        }
    }
}
```
