class in UnityEngine
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 <a>try again</a> 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.
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.
As with other "native engine object" types, it is important to pay attention to the lifetime of any render textures and release them when you are finished using them with the Release function, as they will not be garbage collected like normal managed types.
See Also: Camera.targetTexture.
|Currently active render texture.
|The antialiasing level for the RenderTexture.
|Mipmap levels are generated automatically when this flag is set.
|If true and antiAliasing is greater than 1, the render texture will not be resolved by default. Use this if the render texture needs to be bound as a multisampled texture in a shader.
|Color buffer of the render texture (Read Only).
|The precision of the render texture's depth buffer in bits (0, 16, 24/32 are supported).
|Depth/stencil buffer of the render texture (Read Only).
|This struct contains all the information required to create a RenderTexture. It can be copied, cached, and reused to easily create RenderTextures that all share the same properties.
|Dimensionality (type) of the render texture.
|Enable random access write into this render texture on Shader Model 5.0 level shaders.
|The color format of the render texture.
|The height of the render texture in pixels.
|The render texture memoryless mode property.
|Does this render texture use sRGB read/write conversions? (Read Only).
|The format of the stencil data that you can encapsulate within a RenderTexture.Specifying this property creates a stencil element for the RenderTexture and sets its format. This allows for stencil data to be bound as a Texture to all shader types for the platforms that support it. This property does not specify the format of the stencil buffer, which is constrained by the depth buffer format specified in RenderTexture.depth.Currently, most platforms only support R8_UInt (DirectX11, DirectX12), while PS4 also supports R8_UNorm.
|Is the render texture marked to be scaled by the Dynamic Resolution system.
|Render texture has mipmaps when this flag is set.
|Volume extent of a 3D render texture or number of slices of array texture.
|If this RenderTexture is a VR eye texture used in stereoscopic rendering, this property decides what special rendering occurs, if any.
|The width of the render texture in pixels.
|Creates a new RenderTexture object.
|Converts the render texture to equirectangular format (both stereoscopic or monoscopic equirect). The left eye will occupy the top half and the right eye will occupy the bottom. The monoscopic version will occupy the whole texture. Texture dimension must be of type TextureDimension.Cube.
|Actually creates the RenderTexture.
|Hint the GPU driver that the contents of the RenderTexture will not be used.
|Generate mipmap levels of a render texture.
|Retrieve a native (underlying graphics API) pointer to the depth buffer resource.
|Is the render texture actually created?
|Releases the RenderTexture.
|Force an antialiased render texture to be resolved.
|Assigns this RenderTexture as a global shader property named propertyName.
|Allocate a temporary render texture.
|Release a temporary texture allocated with GetTemporary.
|Does a RenderTexture have stencil buffer?
|Allow Unity internals to perform Texture creation on any thread (rather than the dedicated render thread).
|The amount of memory that all Textures in the scene use.
|The total size of the Textures, in bytes, that Unity loads if there were no other constraints. Before Unity loads any Textures, it applies the memory budget which reduces the loaded Texture resolution if the Texture sizes exceed its value. The `desiredTextureMemory` value takes into account the mipmap levels that Unity has requested or that you have set manually. For example, if Unity does not load a Texture at full resolution because it is far away or its requested mipmap level is greater than 0, Unity reduces the `desiredTextureMemory` value to match the total memory needed.The `desiredTextureMemory` value can be greater than the `targetTextureMemory` value.
|Can be used with Texture constructors that take a mip count to indicate that all mips should be generated. The value of this field is -1.
|The number of non-streaming Textures in the scene. This includes instances of Texture2D and CubeMap Textures. This does not include any other Texture types, or 2D and CubeMap Textures that Unity creates internally.
|The amount of memory Unity allocates for non-streaming Textures in the scene. This only includes instances of Texture2D and CubeMap Textures. This does not include any other Texture types, or 2D and CubeMap Textures that Unity creates internally.
|How many times has a Texture been uploaded due to Texture mipmap streaming.
|Number of renderers registered with the Texture streaming system.
|Number of streaming Textures.
|This property forces the streaming Texture system to discard all unused mipmaps instead of caching them until the Texture memory budget is exceeded. This is useful when you profile or write tests to keep a predictable set of Textures in memory.
|Force streaming Textures to load all mipmap levels.
|Number of streaming Textures with mipmaps currently loading.
|Number of streaming Textures with outstanding mipmaps to be loaded.
|The total amount of Texture memory that Unity allocates to the Textures in the scene after it applies the memory budget and finishes loading Textures. `targetTextureMemory`also takes mipmap streaming settings into account. This value only includes instances of Texture2D and CubeMap Textures. It does not include any other Texture types, or 2D and CubeMap Textures that Unity creates internally.
|The total amount of Texture memory that Unity would use if it loads all Textures at mipmap level 0. This is a theoretical value that does not take into account any input from the streaming system or any other input, for example when you set the`Texture2D.requestedMipmapLevel` manually. To see a Texture memory value that takes inputs into account, use `desiredTextureMemory`. `totalTextureMemory` only includes instances of Texture2D and CubeMap Textures. It does not include any other Texture types, or 2D and CubeMap Textures that Unity creates internally.
|Should the object be hidden, saved with the Scene or modifiable by the user?
|The name of the object.
|Defines the anisotropic filtering level of the Texture.
|Dimensionality (type) of the Texture (Read Only).
|Filtering mode of the Texture.
|Returns the GraphicsFormat format or color format of a Texture object.
|Height of the Texture in pixels. (Read Only)
|The hash value of the Texture.
|Returns true if the Read/Write Enabled checkbox was checked when the Texture was imported; otherwise returns false. For a dynamic Texture created from script, always returns true. For additional information, see TextureImporter.isReadable.
|The mipmap bias of the Texture.
|How many mipmap levels are in this Texture (Read Only).
|This counter is incremented when the Texture is updated.
|Width of the Texture in pixels. (Read Only)
|Texture coordinate wrapping mode.
|Texture U coordinate wrapping mode.
|Texture V coordinate wrapping mode.
|Texture W coordinate wrapping mode for Texture3D.
|Gets the instance ID of the object.
|Returns the name of the object.
|Retrieve a native (underlying graphics API) pointer to the Texture resource.
|Increment the update counter.
|Removes a GameObject, component or asset.
|Destroys the object obj immediately. You are strongly recommended to use Destroy instead.
|Do not destroy the target Object when loading a new Scene.
|Returns the first active loaded object of Type type.
|Gets a list of all loaded objects of Type type.
|Clones the object original and returns the clone.
|Sets Anisotropic limits.
|This function sets mipmap streaming debug properties on any materials that use this Texture through the mipmap streaming system.