Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetTexture

Set a texture property.
Read time 2 minutesLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

SetTexture(string, Texture)

Set a texture property.
public void SetTexture(string name, Texture value)

Parameters

name

The name of the property.

value

The Texture to set.

Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.
By specifying a
RenderTextureSubElement
, you can indicate which type of data to set from the RenderTexture. The possible options are: RenderTextureSubElement.Color, RenderTextureSubElement.Depth, and RenderTextureSubElement.Stencil.

SetTexture(int, Texture)

Set a texture property.
public void SetTexture(int nameID, Texture value)

Parameters

nameID

The name ID of the property retrieved by Shader.PropertyToID.

value

The Texture to set.

Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.
By specifying a
RenderTextureSubElement
, you can indicate which type of data to set from the RenderTexture. The possible options are: RenderTextureSubElement.Color, RenderTextureSubElement.Depth, and RenderTextureSubElement.Stencil.

SetTexture(string, RenderTexture, RenderTextureSubElement)

Set a texture property.
public void SetTexture(string name, RenderTexture value, RenderTextureSubElement element)

Parameters

name

The name of the property.

The Texture to set.

Optional parameter that specifies the type of data to set from the RenderTexture.

Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.
By specifying a
RenderTextureSubElement
, you can indicate which type of data to set from the RenderTexture. The possible options are: RenderTextureSubElement.Color, RenderTextureSubElement.Depth, and RenderTextureSubElement.Stencil.

SetTexture(int, RenderTexture, RenderTextureSubElement)

Set a texture property.
public void SetTexture(int nameID, RenderTexture value, RenderTextureSubElement element)

Parameters

nameID

The name ID of the property retrieved by Shader.PropertyToID.

The Texture to set.

Optional parameter that specifies the type of data to set from the RenderTexture.

Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.
By specifying a
RenderTextureSubElement
, you can indicate which type of data to set from the RenderTexture. The possible options are: RenderTextureSubElement.Color, RenderTextureSubElement.Depth, and RenderTextureSubElement.Stencil.