Uniquely identifies a type of error which may occur when generating reflection information.
Each value of this enum represents a different type of error, the details of which may be found in LogMessage.Text.
Additional resources: LogMessage.ErrorCode.
using UnityEditor; using UnityEditor.ShaderApiReflection; using UnityEngine; // This example adds a menu item which re-logs any reflection errors reported by shader includes // selected in the project view. public class ShaderIncludeReflectionErrorPrinter { [MenuItem("Examples/ShaderIncludeReflectionErrorPrinter")] static void PrintErrors() { // Visit each selected object foreach (Object selectedObject in Selection.objects) { // Check if the object is a ShaderInclude if (selectedObject is ShaderInclude includeObject) { // Re-log each reflection message foreach (LogMessage message in includeObject.Reflection.LogMessages) { string formattedMessage = $"{message.ErrorCode} {message.MessageSeverity} at {message.Location.FilePath}" + $" (line {message.Location.Line}): {message.Text}"; if (message.MessageSeverity == LogMessage.Severity.Error) Debug.LogError(formattedMessage); else Debug.LogWarning(formattedMessage); } } } } }
| Property | Description |
|---|---|
| Unknown | An unspecified error occurred. |
| FailedToLex | The shader source code failed to tokenize. |
| UnexpectedEndOfFile | The shader parser reached the end-of-file marker while searching for a token. |
| UnexpectedToken | The shader parser expected one token but found another. |
| UnmatchedScopeDelimiter | The shader source code lacked a closing brace. |
| UnsupportedShaderSyntax | The shader source code made use of a language construct not supported by the shader API reflection system. |
| XMLSyntaxError | A comment decorating a shader function contained malformed XML. |
| NestedHintContainer | A hint tag was nested within another hint tag. |
| DeepHint | A hint tag was nested within another hint tag. |
| AttributeHint | A hint tag used an XML attribute. |
| NonexistentParameter | An XML tag referenced a nonexisted function parameter. |
| MissingParameterName | An XML tag which requires a function parameter name lacked one. |
| MultiplyDefinedHint | A hint was defined multiple times. |