Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetKeyword

Adds a command to set the state of a global or local shader keyword.
Read time 2 minutesLast updated 4 days ago

Definition

SetKeyword(GlobalKeyword, bool)

Adds a command to set the state of a global or local shader keyword.
public void SetKeyword(in GlobalKeyword keyword, bool value)

Parameters

The local or global shader keyword to set the state for.

value

The state to set the shader keyword state to.

Remarks

Shader keywords determine which shader variants Unity uses. For information on working with local shader keywords and global shader keywords and how they interact, see Using shader keywords with C# scripts.

SetKeyword(Material, LocalKeyword, bool)

Adds a command to set the state of a global or local shader keyword.
public void SetKeyword(Material material, in LocalKeyword keyword, bool value)

Parameters

material

The material for which to set the state of the local shader keyword.

The local or global shader keyword to set the state for.

value

The state to set the shader keyword state to.

Remarks

Shader keywords determine which shader variants Unity uses. For information on working with local shader keywords and global shader keywords and how they interact, see Using shader keywords with C# scripts.

SetKeyword(ComputeShader, LocalKeyword, bool)

Adds a command to set the state of a global or local shader keyword.
public void SetKeyword(ComputeShader computeShader, in LocalKeyword keyword, bool value)

Parameters

computeShader

The compute shader for which to set the state of the local shader keyword.

The local or global shader keyword to set the state for.

value

The state to set the shader keyword state to.

Remarks

Shader keywords determine which shader variants Unity uses. For information on working with local shader keywords and global shader keywords and how they interact, see Using shader keywords with C# scripts.