Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ComputeShader.SetTexture

SetTexture(kernelIndex: int, name: string, texture: Texture): void;
void SetTexture(int kernelIndex, string name, Texture texture);
def SetTexture(kernelIndex as int, name as string, texture as Texture) as void

Description

Set a texture parameter.

This function can either set a regular texture that is read in the compute shader, or an output texture that is written into by the shader. For an output texture, it has to be a RenderTexture with random write flag enabled, see RenderTexture.enableRandomWrite.

See Also: FindKernel, RenderTexture.enableRandomWrite.