# ShaderKeyword

> Initializes a new instance of the ShaderKeyword class from a shader global keyword name.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine.Rendering](/engine/6000.0/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

## ShaderKeyword(string)

Initializes a new instance of the ShaderKeyword class from a shader global keyword name.

```csharp
public ShaderKeyword(string keywordName)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the keyword.

### Remarks

If you call this function and a keyword with the name you pass in does not exist, Unity creates one with that name. To get all the global keywords that already exist, use [Shader.globalKeywords](/engine/6000.0/script-reference/unityengine/shader/globalkeywords.md).

Additional Resources: [IPreprocessShaders.OnProcessShader](/engine/6000.0/script-reference/unityeditor/build/ipreprocessshaders/onprocessshader.md), [IPreprocessComputeShaders.OnProcessComputeShader](/engine/6000.0/script-reference/unityeditor/build/ipreprocesscomputeshaders/onprocesscomputeshader.md).

## ShaderKeyword(Shader, string)

Initializes a new instance of the ShaderKeyword class from a local shader keyword name.

```csharp
public ShaderKeyword(Shader shader, string keywordName)
```

### Parameters

**** (\[Shader]\(/engine/6000.0/script-reference/unityengine/shader)): The shader that declares the keyword.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the keyword.

### Remarks

If the shader defines a local keyword with the given name, Unity creates a valid ShaderKeyword instance that represents the local keyword. Otherwise, Unity creates an invalid ShaderKeyword instance.

Additional Resources: OnProcessShader, [ShaderKeyword.IsValid](/engine/6000.0/script-reference/unityengine/rendering/shaderkeyword/isvalid.md).

## ShaderKeyword(ComputeShader, string)

Initializes a new instance of the ShaderKeyword class from a local shader keyword name, and the compute shader that defines that local keyword.

```csharp
public ShaderKeyword(ComputeShader shader, string keywordName)
```

### Parameters

**** (\[ComputeShader]\(/engine/6000.0/script-reference/unityengine/computeshader)): The compute shader that declares the local keyword.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the keyword.

### Remarks

If the compute shader defines a local keyword with the given name, Unity creates a valid ShaderKeyword instance that represents the local keyword. Otherwise, Unity creates an invalid ShaderKeyword instance.

Additional Resources: [IPreprocessComputeShaders.OnProcessComputeShader](/engine/6000.0/script-reference/unityeditor/build/ipreprocesscomputeshaders/onprocesscomputeshader.md), [ShaderKeyword.IsValid](/engine/6000.0/script-reference/unityengine/rendering/shaderkeyword/isvalid.md).
