Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ErrorCode

Uniquely identifies a type of error which may occur when generating reflection information.
Read time 1 minuteLast updated 5 days ago

Definition

public enum ErrorCode

Remarks

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.

Examples

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); } } } }}

Fields

Value

Description

AttributeHintA hint tag used an XML attribute.
DeepHintA hint tag was nested within another hint tag.
FailedToLexThe shader source code failed to tokenize.
MissingParameterNameAn XML tag which requires a function parameter name lacked one.
MultiplyDefinedHintA hint was defined multiple times.
NestedHintContainerA hint tag was nested within another hint tag.
NonexistentParameterAn XML tag referenced a nonexisted function parameter.
UnexpectedEndOfFileThe shader parser reached the end-of-file marker while searching for a token.
UnexpectedTokenThe shader parser expected one token but found another.
UnknownAn unspecified error occurred.
UnmatchedScopeDelimiterThe shader source code lacked a closing brace.
UnsupportedShaderSyntaxThe shader source code made use of a language construct not supported by the shader API reflection system.
XMLSyntaxErrorA comment decorating a shader function contained malformed XML.