Select your preferred scripting language. All code snippets will be displayed in this language.
Inherits from: Texture
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.Close
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.Close
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.
One typical usage of render textures is setting them as the "target texture" property of a Camera (Camera.targetTexture), this will make a camera render into a texture instead of rendering to the screen.
Another use case is manually implementing various rendering effects, for example Image Effects. There you often get temporary short-lived render textures (GetTemporary and ReleaseTemporary functions), and manually render objects into them (see Graphics.DrawMeshNow and Graphics.Blit).
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 out 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.
See Also: Camera.targetTexture.
|active||Currently active render texture.|
|antiAliasing||The antialiasing level for the RenderTexture.|
|colorBuffer||Color buffer of the render texture (Read Only).|
|depth||The precision of the render texture's depth buffer in bits (0, 16, 24 are supported).|
|depthBuffer||Depth/stencil buffer of the render texture (Read Only).|
|enableRandomWrite||Enable DX11 random access write into this render texture.|
|format||The color format of the render texture.|
|generateMips||Should mipmap levels be generated automatically?|
|height||The height of the render texture in pixels.|
|isCubemap||If enabled, this Render Texture will be used as a Cubemap.|
|isVolume||If enabled, this Render Texture will be used as a Texture3D.|
|sRGB||Does this render texture use sRGB read / write (Read Only).|
|useMipMap||Use mipmaps on a render texture?|
|volumeDepth||Volume extent of a 3D render texture.|
|width||The width of the render texture in pixels.|
|RenderTexture||Creates a new RenderTexture object.|
|Create||Actually creates the RenderTexture.|
|DiscardContents||Discards the contents of the RenderTexture.|
|IsCreated||Is the render texture actually created?|
|MarkRestoreExpected||Indicate that there's a RenderTexture restore operation expected.|
|Release||Releases the RenderTexture.|
|SetGlobalShaderProperty||Assigns this RenderTexture as a global shader property named propertyName.|
|GetTemporary||Allocate a temporary render texture.|
|ReleaseTemporary||Release a temporary texture allocated with GetTemporary.|
|SupportsStencil||Does a RenderTexture have stencil buffer?|
|hideFlags||Should the object be hidden, saved with the scene or modifiable by the user?|
|name||The name of the object.|
|anisoLevel||Anisotropic filtering level of the texture.|
|filterMode||Filtering mode of the texture.|
|height||Height of the texture in pixels. (Read Only)|
|mipMapBias||Mip map bias of the texture.|
|width||Width of the texture in pixels. (Read Only)|
|wrapMode||Wrap mode (Repeat or Clamp) of the texture.|
|GetInstanceID||Returns the instance id of the object.|
|ToString||Returns the name of the game object.|
|GetNativeTextureID||Retrieve native ('hardware') handle to a texture.|
|GetNativeTexturePtr||Retrieve native ('hardware') pointer to a texture.|
|Destroy||Removes a gameobject, component or asset.|
|DestroyImmediate||Destroys the object obj immediately. You are strongly recommended to use Destroy instead.|
|DontDestroyOnLoad||Makes the object target not be destroyed automatically when loading a new scene.|
|FindObjectOfType||Returns the first active loaded object of Type type.|
|FindObjectsOfType||Returns a list of all active loaded objects of Type type.|
|Instantiate||Clones the object original and returns the clone.|
|SetGlobalAnisotropicFilteringLimits||Sets Anisotropic limits.|