RenderTexture Inherits from Texture

Render textures are textures that can be rendered to.

They can be used to implement image based rendering effects, dynamic shadows, projectors, reflections or surveillance cameras.

All rendering goes into the active RenderTexture (active class property). If the active RenderTexture is null everything is rendered to the main window.

Note that while RenderTexture assets can be only power-of-two size, it is possible to create a non-power-of-two (rect) render textures from scripts. These are most often used for image post processing effects.

Keep in mind that render texture contents can become "lost" on certain events, like loading a new level, system going to a screensaver mode, in and our of fullscreen and so on. When that happens, your existing render textures will become "not yet created" again, you can check for that with IsCreated function.

RenderTexture class is only available in Unity Pro.

Variables
width

The width of the render texture in pixels.

height

The height of the render texture in pixels.

depth

The precision of the render texture's depth buffer in bits (0, 16, 24 are supported)

sRGB

Does this render texture use sRGB read / write

format

The format of the render texture.

useMipMap

Generate mipmap levels?

isCubemap

If enabled, this Render Texture will be used as a Cubemap

isVolume

volumeDepth

enableRandomWrite

colorBuffer

Color buffer of the render texture (Read Only).

depthBuffer

Depth buffer of the render texture (Read Only).

Constructors
RenderTexture

Creates a new RenderTexture object.

Functions
Create

Actually creates the RenderTexture.

Release

Releases the RenderTexture.

IsCreated

Is the render texture actually created?

DiscardContents

Discards the contents of the RenderTexture.

SetGlobalShaderProperty

Assigns this RenderTexture as a global shader property named propertyName.

Class Variables
active

The active render texture.

Class Functions
GetTemporary

Allocate a temporary render texture.

ReleaseTemporary

Release a temporary texture allocated with GetTemporary.

Inherited members
Inherited Variables
width

Width of the texture in pixels (Read Only)

height

Height of the texture in pixels (Read Only)

filterMode

Filtering mode of the texture.

anisoLevel

Anisotropic filtering level of the texture.

wrapMode

Wrap mode (Repeat or Clamp) of the texture.

mipMapBias

Mip map bias of the texture.

name

The name of the object.

hideFlags

Should the object be hidden, saved with the scene or modifiable by the user?

Inherited Functions
GetNativeTexturePtr

Retrieve native ('hardware') pointer to a texture.

GetNativeTextureID

Retrieve native ('hardware') handle to a texture.

GetInstanceID

Returns the instance id of the object.

ToString

Returns the name of the game object.

Inherited Class Functions
SetGlobalAnisotropicFilteringLimits

Sets Anisotropic limits.

operator bool

Does the object exist?

Instantiate

Clones the object original and returns the clone.

Destroy

Removes a gameobject, component or asset.

DestroyImmediate

Destroys the object obj immediately. It is strongly recommended to use Destroy instead.

FindObjectsOfType

Returns a list of all active loaded objects of Type type.

FindObjectOfType

Returns the first active loaded object of Type type.

operator ==

Compares if two objects refer to the same

operator !=

Compares if two objects refer to a different object

DontDestroyOnLoad

Makes the object target not be destroyed automatically when loading a new scene.