# ShaderUtil

> Utility functions to assist with working with shaders from the editor.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public sealed class ShaderUtil
```

## Static Properties

| Property                                                                                                                         | Description                                                                           |
| -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [allowAsyncCompilation](/engine/6000.0/script-reference/unityeditor/shaderutil/allowasynccompilation.md)                         | When true, asynchronous Shader compilation is allowed at the current call site.       |
| [anythingCompiling](/engine/6000.0/script-reference/unityeditor/shaderutil/anythingcompiling.md)                                 | When true, the Editor is compiling some Shaders asynchronously at the point of query. |
| [disableShaderOptimization](/engine/6000.0/script-reference/unityeditor/shaderutil/disableshaderoptimization.md)                 | Disables shader optimization in the Editor.                                           |
| [hardwareSupportsRectRenderTexture](/engine/6000.0/script-reference/unityeditor/shaderutil/hardwaresupportsrectrendertexture.md) | Does the current hardware support render textues.                                     |

## Static Methods

| Method                                                                                                                                               | Description                                                                                                                                                                                                                                                                                                                                                           |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ClearCachedData](/engine/6000.0/script-reference/unityeditor/shaderutil/clearcacheddata.md)                                                         | Clears all internally-cached data that was generated for the given shader, such as errors and compilation info.                                                                                                                                                                                                                                                       |
| [ClearShaderMessages](/engine/6000.0/script-reference/unityeditor/shaderutil/clearshadermessages.md)                                                 | Clear compile time messages for the given shader.                                                                                                                                                                                                                                                                                                                     |
| [CompilePass](/engine/6000.0/script-reference/unityeditor/shaderutil/compilepass.md)                                                                 | Request the Editor to compile the Shader Variant needed for the specific pass of the given Material.                                                                                                                                                                                                                                                                  |
| [CreateComputeShaderAsset](/engine/6000.0/script-reference/unityeditor/shaderutil/createcomputeshaderasset.md)                                       | Creates a new [ComputeShader](/engine/6000.0/script-reference/unityengine/computeshader.md) object from the provided source code string. You can use this method alongside the [ScriptedImporter](/engine/6000.0/script-reference/unityeditor/assetimporters/scriptedimporter.md) to create custom compute shader generation tools in the Editor.                     |
| [CreateRayTracingShaderAsset](/engine/6000.0/script-reference/unityeditor/shaderutil/createraytracingshaderasset.md)                                 | Creates a new [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md) object from the provided source code string. You can use this method alongside the [ScriptedImporter](/engine/6000.0/script-reference/unityeditor/assetimporters/scriptedimporter.md) to create custom ray tracing shader generation tools in the Editor. |
| [CreateShaderAsset](/engine/6000.0/script-reference/unityeditor/shaderutil/createshaderasset.md)                                                     | Creates a new [Shader](/engine/6000.0/script-reference/unityengine/shader.md) object from the provided source code string. You can use this method alongside the [ScriptedImporter](/engine/6000.0/script-reference/unityeditor/assetimporters/scriptedimporter.md) to create custom shader generation tools in the Editor.                                           |
| [GetAllShaderInfo](/engine/6000.0/script-reference/unityeditor/shaderutil/getallshaderinfo.md)                                                       | Returns an array of [ShaderInfo](/engine/6000.0/script-reference/unityeditor/shaderinfo.md) of all available shaders. That includes built-in shaders.                                                                                                                                                                                                                 |
| [GetCallableShaderCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getcallableshadercount.md)                                           | Returns the number of callable Shaders defined whitin a given [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                                          |
| [GetCallableShaderName](/engine/6000.0/script-reference/unityeditor/shaderutil/getcallableshadername.md)                                             | Returns the name of a user-defined callable Shader from within a [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                                       |
| [GetCallableShaderParamSize](/engine/6000.0/script-reference/unityeditor/shaderutil/getcallableshaderparamsize.md)                                   | Returns the parameter size of a user-defined callable Shader from within a [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                             |
| [GetComputeShaderMessageCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getcomputeshadermessagecount.md)                               | Returns the number of errors and warnings generated by the Unity Shader Compiler for the given [ComputeShader](/engine/6000.0/script-reference/unityengine/computeshader.md).                                                                                                                                                                                         |
| [GetComputeShaderMessages](/engine/6000.0/script-reference/unityeditor/shaderutil/getcomputeshadermessages.md)                                       | Returns each error and warning generated by the Unity Shader Compiler for the given [ComputeShader](/engine/6000.0/script-reference/unityengine/computeshader.md).                                                                                                                                                                                                    |
| [GetCurrentCustomEditor](/engine/6000.0/script-reference/unityeditor/shaderutil/getcurrentcustomeditor.md)                                           | Gets the current custom editor for the shader you pass in.                                                                                                                                                                                                                                                                                                            |
| [GetCustomEditorForRenderPipeline](/engine/6000.0/script-reference/unityeditor/shaderutil/getcustomeditorforrenderpipeline.md)                       | Gets the shader's custom editor class name for a specific render pipeline asset type.                                                                                                                                                                                                                                                                                 |
| [GetMissShaderCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getmissshadercount.md)                                                   | Returns the number of miss Shaders defined whitin a given [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                                              |
| [GetMissShaderName](/engine/6000.0/script-reference/unityeditor/shaderutil/getmissshadername.md)                                                     | Returns the name of a user-defined miss Shader from within a [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                                           |
| [GetMissShaderRayPayloadSize](/engine/6000.0/script-reference/unityeditor/shaderutil/getmissshaderraypayloadsize.md)                                 | Returns the ray payload size of a user-defined miss Shader from within a [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                               |
| [GetPassKeywords](/engine/6000.0/script-reference/unityeditor/shaderutil/getpasskeywords.md)                                                         | Gets the local shader keywords that are valid for a Pass within a particular shader.                                                                                                                                                                                                                                                                                  |
| [GetPropertyCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getpropertycount.md)                                                       | Get the number of properties in Shader s.                                                                                                                                                                                                                                                                                                                             |
| [GetPropertyDescription](/engine/6000.0/script-reference/unityeditor/shaderutil/getpropertydescription.md)                                           | Get the description of the shader propery at index propertyIdx of Shader s.                                                                                                                                                                                                                                                                                           |
| [GetPropertyName](/engine/6000.0/script-reference/unityeditor/shaderutil/getpropertyname.md)                                                         | Get the name of the shader propery at index propertyIdx of Shader s.                                                                                                                                                                                                                                                                                                  |
| [GetPropertyType](/engine/6000.0/script-reference/unityeditor/shaderutil/getpropertytype.md)                                                         | Get the ShaderProperyType of the shader propery at index propertyIdx of Shader s.                                                                                                                                                                                                                                                                                     |
| [GetRangeLimits](/engine/6000.0/script-reference/unityeditor/shaderutil/getrangelimits.md)                                                           | Get Limits for a range property at index propertyIdx of Shader s.                                                                                                                                                                                                                                                                                                     |
| [GetRayGenerationShaderCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getraygenerationshadercount.md)                                 | Returns the number of ray generation Shaders defined whitin a given [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                                    |
| [GetRayGenerationShaderName](/engine/6000.0/script-reference/unityeditor/shaderutil/getraygenerationshadername.md)                                   | Returns the name of a user-defined ray generation Shader from within a [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                                 |
| [GetRayTracingShaderMessageCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getraytracingshadermessagecount.md)                         | Returns the number of errors and warnings generated by the Shader Compiler for the given [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                               |
| [GetRayTracingShaderMessages](/engine/6000.0/script-reference/unityeditor/shaderutil/getraytracingshadermessages.md)                                 | Returns each error and warning generated by the Shader Compiler for the given [RayTracingShader](/engine/6000.0/script-reference/unityengine/rendering/raytracingshader.md).                                                                                                                                                                                          |
| [GetShaderData](/engine/6000.0/script-reference/unityeditor/shaderutil/getshaderdata.md)                                                             | Get the shader data for a specific shader.                                                                                                                                                                                                                                                                                                                            |
| [GetShaderInfo](/engine/6000.0/script-reference/unityeditor/shaderutil/getshaderinfo.md)                                                             | Gets [ShaderInfo](/engine/6000.0/script-reference/unityeditor/shaderinfo.md) for the given shader.                                                                                                                                                                                                                                                                    |
| [GetShaderMessageCount](/engine/6000.0/script-reference/unityeditor/shaderutil/getshadermessagecount.md)                                             | Returns the number of errors and warnings generated by the Unity Shader Compiler for the given [Shader](/engine/6000.0/script-reference/unityengine/shader.md).                                                                                                                                                                                                       |
| [GetShaderMessages](/engine/6000.0/script-reference/unityeditor/shaderutil/getshadermessages.md)                                                     | Returns each error and warning generated by the Unity Shader Compiler for the given [Shader](/engine/6000.0/script-reference/unityengine/shader.md).                                                                                                                                                                                                                  |
| [GetShaderPlatformKeywordsForBuildTarget](/engine/6000.0/script-reference/unityeditor/shaderutil/getshaderplatformkeywordsforbuildtarget.md)         | Gets the platform keywords for a shader, given a shader compiler platform, build target, and optional graphics tier. These platform keywords are necessary to properly compile a shader for a given target.                                                                                                                                                           |
| [GetTexDim](/engine/6000.0/script-reference/unityeditor/shaderutil/gettexdim.md)                                                                     | Gets texture dimension of a shader property.                                                                                                                                                                                                                                                                                                                          |
| [HasProceduralInstancing](/engine/6000.0/script-reference/unityeditor/shaderutil/hasproceduralinstancing.md)                                         | Determines whether the specified Shader contains a valid Procedural Instancing variant.                                                                                                                                                                                                                                                                               |
| [IsPassCompiled](/engine/6000.0/script-reference/unityeditor/shaderutil/ispasscompiled.md)                                                           | Checks if the Shader variant for the given pass in the Material has already been compiled.                                                                                                                                                                                                                                                                            |
| [IsShaderPropertyHidden](/engine/6000.0/script-reference/unityeditor/shaderutil/isshaderpropertyhidden.md)                                           | Returns true if the shader propery at index `propertyIdx` is hidden with the `[HideInInspector]` attribute in the shader code.                                                                                                                                                                                                                                        |
| [IsShaderPropertyNonModifiableTexureProperty](/engine/6000.0/script-reference/unityeditor/shaderutil/isshaderpropertynonmodifiabletexureproperty.md) | Is the shader propery at index propertyIdx of Shader s a NonModifiableTextureProperty?                                                                                                                                                                                                                                                                                |
| [PassHasKeyword](/engine/6000.0/script-reference/unityeditor/shaderutil/passhaskeyword.md)                                                           | Checks whether a local shader keyword is valid for a Pass within a particular shader.                                                                                                                                                                                                                                                                                 |
| [RegisterShader](/engine/6000.0/script-reference/unityeditor/shaderutil/registershader.md)                                                           | Register a user created shader.                                                                                                                                                                                                                                                                                                                                       |
| [RestoreAsyncCompilation](/engine/6000.0/script-reference/unityeditor/shaderutil/restoreasynccompilation.md)                                         | Restores the previous Shader compilation mode in this CommandBuffer scope.                                                                                                                                                                                                                                                                                            |
| [SetAsyncCompilation](/engine/6000.0/script-reference/unityeditor/shaderutil/setasynccompilation.md)                                                 | Adds shader compilation mode command in the CommandBuffer.                                                                                                                                                                                                                                                                                                            |
| [ShaderHasError](/engine/6000.0/script-reference/unityeditor/shaderutil/shaderhaserror.md)                                                           | Checks if a shader has any compilation errors. Ignores warnings.                                                                                                                                                                                                                                                                                                      |
| [ShaderHasWarnings](/engine/6000.0/script-reference/unityeditor/shaderutil/shaderhaswarnings.md)                                                     | Checks if a shader has any compilation warnings. Ignores errors.                                                                                                                                                                                                                                                                                                      |
| [UpdateShaderAsset](/engine/6000.0/script-reference/unityeditor/shaderutil/updateshaderasset.md)                                                     | Replaces the existing source code in the specified shader with the source code in the supplied string.                                                                                                                                                                                                                                                                |

## Enums

| Enum                                                                                                          | Description                       |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| [ShaderUtil.ShaderPropertyType](/engine/6000.0/script-reference/unityeditor/shaderutil/shaderpropertytype.md) | Type of a given texture property. |
