ValidateDefines(string[], out string)
Validates the given array of constant defines.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Shaders
- Assembly: UnityEditor.CoreModule
ValidateDefines(string[], string)
public static bool ValidateDefines(string[] defines, out string msg)
Parameters
Returns
Type | Description |
|---|---|
| bool | 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
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); } }}