# SetAsyncCompilation(CommandBuffer, bool)

> Adds shader compilation mode command in the CommandBuffer.

## Definition

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

```csharp
public static void SetAsyncCompilation(CommandBuffer cmd, bool allow)
```

### Parameters

**** (\[CommandBuffer]\(/engine/6000.7/script-reference/unityengine/rendering/commandbuffer)): Target CommandBuffer.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Is async Shader compilation allowed or not.

### Remarks

The Editor compiles Shader Variants on-demand, the first time rendering requires a particular Shader Variant. By default, asynchronous Shader compilation is only enabled for requests that originate from the Game View or Scene View. With this method, you can add commands to [CommandBuffer](/engine/6000.7/script-reference/unityengine/rendering/commandbuffer.md) that control the Shader compilation during the execution of the buffer. This lets you disable and enable asynchronous compilation on specific parts of rendering, both for Game View, Scene View and other Views, for example custom tools. To restore the previous compilation mode, see [ShaderUtil.RestoreAsyncCompilation](/engine/6000.7/script-reference/unityeditor/shaderutil/restoreasynccompilation.md).

Additional Resources: [ShaderUtil.RestoreAsyncCompilation](/engine/6000.7/script-reference/unityeditor/shaderutil/restoreasynccompilation.md), [ShaderUtil.allowAsyncCompilation](/engine/6000.7/script-reference/unityeditor/shaderutil/allowasynccompilation.md), [ShaderUtil.anythingCompiling](/engine/6000.7/script-reference/unityeditor/shaderutil/anythingcompiling.md), [ShaderUtil.IsPassCompiled](/engine/6000.7/script-reference/unityeditor/shaderutil/ispasscompiled.md), [ShaderUtil.CompilePass](/engine/6000.7/script-reference/unityeditor/shaderutil/compilepass.md).
