# PreprocessVariant

> Preprocesses a shader variant for this shader pass and returns the preprocessed code.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.6/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## PreprocessVariant(ShaderType, string\[], ShaderCompilerPlatform, BuildTarget, bool)

Preprocesses a shader variant for this shader pass and returns the preprocessed code.

```csharp
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, bool stripLineDirectives)
```

### Parameters

**** (\[ShaderType]\(/engine/6000.6/script-reference/unityeditor/rendering/shadertype)): The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.)  Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): The keywords to use during the preprocessing.**** (\[ShaderCompilerPlatform]\(/engine/6000.6/script-reference/unityeditor/rendering/shadercompilerplatform)): The shader compiler platform to preprocess for.**** (\[BuildTarget]\(/engine/6000.6/script-reference/unityeditor/buildtarget)): The build target to preprocess for.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.

### Returns

| Type                                                                                                 | Description                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PreprocessedVariant](/engine/6000.6/script-reference/unityeditor/shaderdata/preprocessedvariant.md) | The preprocessed variant result. If the pass doesn't include the requested program, or if the pass is not the correct type, this function still succeeds but returns empty preprocessed code. |

## PreprocessVariant(ShaderType, string\[], ShaderCompilerPlatform, BuildTarget, GraphicsTier, bool)

Preprocesses a shader variant for this shader pass and returns the preprocessed code.

```csharp
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, GraphicsTier tier, bool stripLineDirectives)
```

### Parameters

**** (\[ShaderType]\(/engine/6000.6/script-reference/unityeditor/rendering/shadertype)): The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.)  Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): The keywords to use during the preprocessing.**** (\[ShaderCompilerPlatform]\(/engine/6000.6/script-reference/unityeditor/rendering/shadercompilerplatform)): The shader compiler platform to preprocess for.**** (\[BuildTarget]\(/engine/6000.6/script-reference/unityeditor/buildtarget)): The build target to preprocess for.**** (\[GraphicsTier]\(/engine/6000.6/script-reference/unityengine/rendering/graphicstier)): An optional graphics tier.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.

### Returns

| Type                                                                                                 | Description                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PreprocessedVariant](/engine/6000.6/script-reference/unityeditor/shaderdata/preprocessedvariant.md) | The preprocessed variant result. If the pass doesn't include the requested program, or if the pass is not the correct type, this function still succeeds but returns empty preprocessed code. |

## PreprocessVariant(ShaderType, string\[], ShaderCompilerPlatform, BuildTarget, BuiltinShaderDefine\[], bool)

Preprocesses a shader variant for this shader pass and returns the preprocessed code.

```csharp
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords, bool stripLineDirectives)
```

### Parameters

**** (\[ShaderType]\(/engine/6000.6/script-reference/unityeditor/rendering/shadertype)): The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.)  Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): The keywords to use during the preprocessing.**** (\[ShaderCompilerPlatform]\(/engine/6000.6/script-reference/unityeditor/rendering/shadercompilerplatform)): The shader compiler platform to preprocess for.**** (\[BuildTarget]\(/engine/6000.6/script-reference/unityeditor/buildtarget)): The build target to preprocess for.**** (\[BuiltinShaderDefine\[]]\(/engine/6000.6/script-reference/unityengine/rendering/builtinshaderdefine)): An optional set of platform keywords. If you do not provide any, Unity uses the default keywords for the given platform, target, and tier.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.

### Returns

| Type                                                                                                 | Description                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PreprocessedVariant](/engine/6000.6/script-reference/unityeditor/shaderdata/preprocessedvariant.md) | The preprocessed variant result. If the pass doesn't include the requested program, or if the pass is not the correct type, this function still succeeds but returns empty preprocessed code. |

## PreprocessVariant(ShaderType, string\[], ShaderCompilerPlatform, BuildTarget, BuiltinShaderDefine\[], GraphicsTier, bool)

Preprocesses a shader variant for this shader pass and returns the preprocessed code.

```csharp
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords, GraphicsTier tier, bool stripLineDirectives)
```

### Parameters

**** (\[ShaderType]\(/engine/6000.6/script-reference/unityeditor/rendering/shadertype)): The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.)  Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): The keywords to use during the preprocessing.**** (\[ShaderCompilerPlatform]\(/engine/6000.6/script-reference/unityeditor/rendering/shadercompilerplatform)): The shader compiler platform to preprocess for.**** (\[BuildTarget]\(/engine/6000.6/script-reference/unityeditor/buildtarget)): The build target to preprocess for.**** (\[BuiltinShaderDefine\[]]\(/engine/6000.6/script-reference/unityengine/rendering/builtinshaderdefine)): An optional set of platform keywords. If you do not provide any, Unity uses the default keywords for the given platform, target, and tier.**** (\[GraphicsTier]\(/engine/6000.6/script-reference/unityengine/rendering/graphicstier)): An optional graphics tier.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.

### Returns

| Type                                                                                                 | Description                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PreprocessedVariant](/engine/6000.6/script-reference/unityeditor/shaderdata/preprocessedvariant.md) | The preprocessed variant result. If the pass doesn't include the requested program, or if the pass is not the correct type, this function still succeeds but returns empty preprocessed code. |
