# Shader

> Shader scripts used for all rendering.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule
* **Inherits from:** [Object](/engine/6000.6/script-reference/unityengine/object.md)

```csharp
public sealed class Shader : Object
```

## Remarks

Most of the advanced rendering is controlled via [Material](/engine/6000.6/script-reference/unityengine/material.md) class. Shader class is mostly used just to check whether a shader can run on the user's hardware ([Shader.isSupported](/engine/6000.6/script-reference/unityengine/shader/issupported.md) property), setting up global shader properties and keywords, and finding shaders by name ([Shader.Find](/engine/6000.6/script-reference/unityengine/shader/find.md) method).

Additional Resources: [Material](/engine/6000.6/script-reference/unityengine/material.md) class, [Materials](/engine/6000.6/manual/materials-and-shaders/materials.md), [ShaderLab documentation](/engine/6000.6/script-reference/unityengine/shaders.md).

## Properties

| Property                                                                               | Description                                                     |
| -------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [isSupported](/engine/6000.6/script-reference/unityengine/shader/issupported.md)       | Can this shader run on the end-users graphics card? (Read Only) |
| [keywordSpace](/engine/6000.6/script-reference/unityengine/shader/keywordspace.md)     | The local keyword space of this shader.                         |
| [maximumLOD](/engine/6000.6/script-reference/unityengine/shader/maximumlod.md)         | Shader LOD level for this shader.                               |
| [passCount](/engine/6000.6/script-reference/unityengine/shader/passcount.md)           | Returns the number of shader passes on the active SubShader.    |
| [renderQueue](/engine/6000.6/script-reference/unityengine/shader/renderqueue.md)       | The default render queue for this shader. (Read Only)           |
| [subshaderCount](/engine/6000.6/script-reference/unityengine/shader/subshadercount.md) | Returns the number of SubShaders in this shader.                |

## Static Properties

| Property                                                                                             | Description                                                                                                                     |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [enabledGlobalKeywords](/engine/6000.6/script-reference/unityengine/shader/enabledglobalkeywords.md) | An array containing the global shader keywords that are currently enabled.                                                      |
| [globalKeywords](/engine/6000.6/script-reference/unityengine/shader/globalkeywords.md)               | An array containing the global shader keywords that currently exist. This includes enabled and disabled global shader keywords. |
| [globalMaximumLOD](/engine/6000.6/script-reference/unityengine/shader/globalmaximumlod.md)           | Shader LOD level for all shaders.                                                                                               |
| [globalRenderPipeline](/engine/6000.6/script-reference/unityengine/shader/globalrenderpipeline.md)   | Render pipeline currently in use.                                                                                               |
| [maximumChunksOverride](/engine/6000.6/script-reference/unityengine/shader/maximumchunksoverride.md) | Sets the limit on the number of shader variant chunks Unity loads and keeps in memory.                                          |

## Methods

| Method                                                                                                               | Description                                                                                                                                                                                                                                           |
| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [FindPassTagValue](/engine/6000.6/script-reference/unityengine/shader/findpasstagvalue.md)                           | Searches for the tag specified by `tagName` on the SubShader specified by `subshaderIndex` and returns the value of the tag.                                                                                                                          |
| [FindPropertyIndex](/engine/6000.6/script-reference/unityengine/shader/findpropertyindex.md)                         | Finds the index of a shader property by its name.                                                                                                                                                                                                     |
| [FindSubshaderTagValue](/engine/6000.6/script-reference/unityengine/shader/findsubshadertagvalue.md)                 | Searches for the tag specified by `tagName` on the SubShader specified by `subshaderIndex` and returns the value of the tag.                                                                                                                          |
| [FindTextureStack](/engine/6000.6/script-reference/unityengine/shader/findtexturestack.md)                           | Find the name of a texture stack a texture belongs too.                                                                                                                                                                                               |
| [GetDependency](/engine/6000.6/script-reference/unityengine/shader/getdependency.md)                                 | Returns the dependency shader.                                                                                                                                                                                                                        |
| [GetPassCountInSubshader](/engine/6000.6/script-reference/unityengine/shader/getpasscountinsubshader.md)             | Returns the number of passes in the given SubShader.                                                                                                                                                                                                  |
| [GetPropertyAttributes](/engine/6000.6/script-reference/unityengine/shader/getpropertyattributes.md)                 | Returns an array of strings containing attributes of the shader property at the specified index.                                                                                                                                                      |
| [GetPropertyCount](/engine/6000.6/script-reference/unityengine/shader/getpropertycount.md)                           | Returns the number of properties in this Shader.                                                                                                                                                                                                      |
| [GetPropertyDefaultFloatValue](/engine/6000.6/script-reference/unityengine/shader/getpropertydefaultfloatvalue.md)   | Returns the default float value of the shader property at the specified index.                                                                                                                                                                        |
| [GetPropertyDefaultIntValue](/engine/6000.6/script-reference/unityengine/shader/getpropertydefaultintvalue.md)       | Returns the default int value of the shader property at the specified index.                                                                                                                                                                          |
| [GetPropertyDefaultVectorValue](/engine/6000.6/script-reference/unityengine/shader/getpropertydefaultvectorvalue.md) | Returns the default Vector4 value of the shader property at the specified index.                                                                                                                                                                      |
| [GetPropertyDescription](/engine/6000.6/script-reference/unityengine/shader/getpropertydescription.md)               | Returns the description string of the shader property at the specified index.                                                                                                                                                                         |
| [GetPropertyFlags](/engine/6000.6/script-reference/unityengine/shader/getpropertyflags.md)                           | Returns the [ShaderPropertyFlags](/engine/6000.6/script-reference/unityengine/rendering/shaderpropertyflags.md) of the shader property at the specified index.                                                                                        |
| [GetPropertyName](/engine/6000.6/script-reference/unityengine/shader/getpropertyname.md)                             | Returns the name of the shader property at the specified index.                                                                                                                                                                                       |
| [GetPropertyNameId](/engine/6000.6/script-reference/unityengine/shader/getpropertynameid.md)                         | Returns the nameId of the shader property at the specified index.                                                                                                                                                                                     |
| [GetPropertyRangeLimits](/engine/6000.6/script-reference/unityengine/shader/getpropertyrangelimits.md)               | Returns the min and max limits for a [Range](/engine/6000.6/script-reference/unityengine/rendering/shaderpropertytype/range.md) property at the specified index.                                                                                      |
| [GetPropertyTextureDefaultName](/engine/6000.6/script-reference/unityengine/shader/getpropertytexturedefaultname.md) | Returns the default Texture name of a [Texture](/engine/6000.6/script-reference/unityengine/rendering/shaderpropertytype/texture.md) shader property at the specified index.                                                                          |
| [GetPropertyTextureDimension](/engine/6000.6/script-reference/unityengine/shader/getpropertytexturedimension.md)     | Returns the [TextureDimension](/engine/6000.6/script-reference/unityengine/rendering/texturedimension.md) of a [Texture](/engine/6000.6/script-reference/unityengine/rendering/shaderpropertytype/texture.md) shader property at the specified index. |
| [GetPropertyType](/engine/6000.6/script-reference/unityengine/shader/getpropertytype.md)                             | Returns the [ShaderPropertyType](/engine/6000.6/script-reference/unityengine/rendering/shaderpropertytype.md) of the property at the specified index.                                                                                                 |

## Static Methods

| Method                                                                                                                                     | Description                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [DisableKeyword](/engine/6000.6/script-reference/unityengine/shader/disablekeyword.md)                                                     | Disables a global shader keyword.                                                                                                                                                                                                          |
| [EnableKeyword](/engine/6000.6/script-reference/unityengine/shader/enablekeyword.md)                                                       | Enables a global shader keyword.                                                                                                                                                                                                           |
| [Find](/engine/6000.6/script-reference/unityengine/shader/find.md)                                                                         | Finds a shader with the given `name`. Returns `null` if the shader is not found.                                                                                                                                                           |
| [GetGlobalColor](/engine/6000.6/script-reference/unityengine/shader/getglobalcolor.md)                                                     | Gets a global color property for all shaders previously set using [Shader.SetGlobalColor](/engine/6000.6/script-reference/unityengine/shader/setglobalcolor.md).                                                                           |
| [GetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/getglobalfloat.md)                                                     | Gets a global float property for all shaders previously set using [Shader.SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md).                                                                           |
| [GetGlobalFloatArray](/engine/6000.6/script-reference/unityengine/shader/getglobalfloatarray.md)                                           | Gets a global float array for all shaders previously set using [Shader.SetGlobalFloatArray](/engine/6000.6/script-reference/unityengine/shader/setglobalfloatarray.md).                                                                    |
| [GetGlobalInt](/engine/6000.6/script-reference/unityengine/shader/getglobalint.md)                                                         | This method is deprecated. Use [Shader.GetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/getglobalfloat.md) or [Shader.GetGlobalInteger](/engine/6000.6/script-reference/unityengine/shader/getglobalinteger.md) instead. |
| [GetGlobalInteger](/engine/6000.6/script-reference/unityengine/shader/getglobalinteger.md)                                                 | Gets a global integer property for all shaders previously set using [Shader.SetGlobalInteger](/engine/6000.6/script-reference/unityengine/shader/setglobalinteger.md).                                                                     |
| [GetGlobalMatrix](/engine/6000.6/script-reference/unityengine/shader/getglobalmatrix.md)                                                   | Gets a global matrix property for all shaders previously set using [Shader.SetGlobalMatrix](/engine/6000.6/script-reference/unityengine/shader/setglobalmatrix.md).                                                                        |
| [GetGlobalMatrixArray](/engine/6000.6/script-reference/unityengine/shader/getglobalmatrixarray.md)                                         | Gets a global matrix array for all shaders previously set using [Shader.SetGlobalMatrixArray](/engine/6000.6/script-reference/unityengine/shader/setglobalmatrixarray.md).                                                                 |
| [GetGlobalTexture](/engine/6000.6/script-reference/unityengine/shader/getglobaltexture.md)                                                 | Gets a global texture property for all shaders previously set using [Shader.SetGlobalTexture](/engine/6000.6/script-reference/unityengine/shader/setglobaltexture.md).                                                                     |
| [GetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/getglobalvector.md)                                                   | Gets a global vector property for all shaders previously set using [Shader.SetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/setglobalvector.md).                                                                        |
| [GetGlobalVectorArray](/engine/6000.6/script-reference/unityengine/shader/getglobalvectorarray.md)                                         | Gets a global vector array for all shaders previously set using [Shader.SetGlobalVectorArray](/engine/6000.6/script-reference/unityengine/shader/setglobalvectorarray.md).                                                                 |
| [IsKeywordEnabled](/engine/6000.6/script-reference/unityengine/shader/iskeywordenabled.md)                                                 | Checks whether a global shader keyword is enabled.                                                                                                                                                                                         |
| [PropertyIDToName](/engine/6000.6/script-reference/unityengine/shader/propertyidtoname.md)                                                 | Returns the name of the shader property from its ID, or null string if the ID is invalid.                                                                                                                                                  |
| [PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md)                                                         | Gets unique identifier for a shader property name.                                                                                                                                                                                         |
| [SetGlobalBuffer](/engine/6000.6/script-reference/unityengine/shader/setglobalbuffer.md)                                                   | Sets a global buffer property for all shaders.                                                                                                                                                                                             |
| [SetGlobalColor](/engine/6000.6/script-reference/unityengine/shader/setglobalcolor.md)                                                     | Sets a global color property for all shaders.                                                                                                                                                                                              |
| [SetGlobalConstantBuffer](/engine/6000.6/script-reference/unityengine/shader/setglobalconstantbuffer.md)                                   | Sets a [ComputeBuffer](/engine/6000.6/script-reference/unityengine/computebuffer.md) or [GraphicsBuffer](/engine/6000.6/script-reference/unityengine/graphicsbuffer.md) as a named constant buffer for all shader types.                   |
| [SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md)                                                     | Sets a global float property for all shaders.                                                                                                                                                                                              |
| [SetGlobalFloatArray](/engine/6000.6/script-reference/unityengine/shader/setglobalfloatarray.md)                                           | Sets a global float array property for all shaders.                                                                                                                                                                                        |
| [SetGlobalInt](/engine/6000.6/script-reference/unityengine/shader/setglobalint.md)                                                         | This method is deprecated. Use [Shader.SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md) or [Shader.SetGlobalInteger](/engine/6000.6/script-reference/unityengine/shader/setglobalinteger.md) instead. |
| [SetGlobalInteger](/engine/6000.6/script-reference/unityengine/shader/setglobalinteger.md)                                                 | Sets a global integer property for all shaders.                                                                                                                                                                                            |
| [SetGlobalMatrix](/engine/6000.6/script-reference/unityengine/shader/setglobalmatrix.md)                                                   | Sets a global matrix property for all shaders.                                                                                                                                                                                             |
| [SetGlobalMatrixArray](/engine/6000.6/script-reference/unityengine/shader/setglobalmatrixarray.md)                                         | Sets a global matrix array property for all shaders.                                                                                                                                                                                       |
| [SetGlobalRayTracingAccelerationStructure](/engine/6000.6/script-reference/unityengine/shader/setglobalraytracingaccelerationstructure.md) | Sets a global [RayTracingAccelerationStructure](/engine/6000.6/script-reference/unityengine/rendering/raytracingaccelerationstructure.md) property for all shaders.                                                                        |
| [SetGlobalTexture](/engine/6000.6/script-reference/unityengine/shader/setglobaltexture.md)                                                 | Sets a global texture property for all shaders.                                                                                                                                                                                            |
| [SetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/setglobalvector.md)                                                   | Sets a global vector property for all shaders.                                                                                                                                                                                             |
| [SetGlobalVectorArray](/engine/6000.6/script-reference/unityengine/shader/setglobalvectorarray.md)                                         | Sets a global vector array property for all shaders.                                                                                                                                                                                       |
| [SetKeyword](/engine/6000.6/script-reference/unityengine/shader/setkeyword.md)                                                             | Sets the state of a global shader keyword.                                                                                                                                                                                                 |
| [TryConvertPropertyIDToName](/engine/6000.6/script-reference/unityengine/shader/tryconvertpropertyidtoname.md)                             | Returns whether the property ID is valid and outputs the corresponding property name if it exists.                                                                                                                                         |
| [WarmupAllShaders](/engine/6000.6/script-reference/unityengine/shader/warmupallshaders.md)                                                 | Prewarms all shader variants of all Shaders currently in memory.                                                                                                                                                                           |

## Inheritance

**Inherited Members:**

* [Object.GetEntityId()](/engine/6000.6/script-reference/unityengine/object/getentityid.md)
* [Object.GetHashCode()](/engine/6000.6/script-reference/unityengine/object/gethashcode.md)
* [Object.InstantiateAsync\<T>(T)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform, Vector3, Quaternion)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, InstantiateParameters, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, InstantiateParameters, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, InstantiateParameters, CancellationToken)](/engine/6000.6/script-reference/unityengine/object/instantiateasync.md)
* [Object.Instantiate(Object, Vector3, Quaternion)](/engine/6000.6/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion\))
* [Object.Instantiate(Object, Vector3, Quaternion, Transform)](/engine/6000.6/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion-transform\))
* [Object.Instantiate(Object)](/engine/6000.6/script-reference/unityengine/object/instantiate.md#instantiate\(object\))
* [Object.Instantiate(Object, Scene)](/engine/6000.6/script-reference/unityengine/object/instantiate.md#instantiate\(object-scene\))
* [Object.Instantiate\<T>(T, InstantiateParameters)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, InstantiateParameters)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate(Object, Transform)](/engine/6000.6/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform\))
* [Object.Instantiate(Object, Transform, bool)](/engine/6000.6/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform-bool\))
* [Object.Instantiate\<T>(T)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, Transform)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform, bool)](/engine/6000.6/script-reference/unityengine/object/instantiate.md)
* [Object.Destroy(Object, float)](/engine/6000.6/script-reference/unityengine/object/destroy.md)
* [Object.DestroyImmediate(Object, bool)](/engine/6000.6/script-reference/unityengine/object/destroyimmediate.md)
* [Object.FindObjectsByType(Type)](/engine/6000.6/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type\))
* [Object.FindObjectsByType(Type, FindObjectsInactive)](/engine/6000.6/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type-findobjectsinactive\))
* [Object.DontDestroyOnLoad(Object)](/engine/6000.6/script-reference/unityengine/object/dontdestroyonload.md)
* [Object.FindAnyObjectByType\<T>()](/engine/6000.6/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(\))
* [Object.FindAnyObjectByType\<T>(FindObjectsInactive)](/engine/6000.6/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(findobjectsinactive\))
* [Object.FindObjectsByType\<T>()](/engine/6000.6/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(\))
* [Object.FindObjectsByType\<T>(FindObjectsInactive)](/engine/6000.6/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(findobjectsinactive\))
* [Object.FindAnyObjectByType(Type)](/engine/6000.6/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type\))
* [Object.FindAnyObjectByType(Type, FindObjectsInactive)](/engine/6000.6/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type-findobjectsinactive\))
* [Object.ToString()](/engine/6000.6/script-reference/unityengine/object/tostring.md)
* [Object.name](/engine/6000.6/script-reference/unityengine/object/name.md)
* [Object.hideFlags](/engine/6000.6/script-reference/unityengine/object/hideflags.md)

### Operators

| Operator                                                                           | Description                                                             |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [operator ==](/engine/6000.6/script-reference/unityengine/object/op-equality.md)   | Compares two object references to see if they refer to the same object. |
| [bool](/engine/6000.6/script-reference/unityengine/object/op-implicit.md)          | Determines whether the object exists.                                   |
| [operator !=](/engine/6000.6/script-reference/unityengine/object/op-inequality.md) | Compares if two objects refer to a different object.                    |
