# LocalKeyword

> Initializes and returns a LocalKeyword struct that represents an existing local shader keyword for a given Shader.

## Definition

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

## LocalKeyword(Shader, string)

Initializes and returns a LocalKeyword struct that represents an existing local shader keyword for a given [Shader](/engine/6000.0/script-reference/unityengine/shader.md).

```csharp
public LocalKeyword(Shader shader, string name)
```

### Parameters

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

### Remarks

If the Shader declares a local shader keyword with the given name, Unity creates and returns a `LocalKeyword` struct that represents it. Otherwise, Unity still creates a struct, but throws an error.

Additional Resources: Shader variants and keywords, [IPreprocessShaders.OnProcessShader](/engine/6000.0/script-reference/unityeditor/build/ipreprocessshaders/onprocessshader.md).

## LocalKeyword(ComputeShader, string)

Initializes and returns a LocalKeyword struct that represents an existing local shader keyword for a given [ComputeShader](/engine/6000.0/script-reference/unityengine/computeshader.md).

```csharp
public LocalKeyword(ComputeShader shader, string name)
```

### Parameters

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

### Remarks

If the ComputeShader declares a local shader keyword with the given name, Unity creates and returns a `LocalKeyword` struct that represents it. Otherwise, Unity still creates a struct, but throws an error.

Additional Resources: Shader variants and keywords, [IPreprocessComputeShaders.OnProcessComputeShader](/engine/6000.0/script-reference/unityeditor/build/ipreprocesscomputeshaders/onprocesscomputeshader.md).
