Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


targetTexture

Destination render texture.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public RenderTexture targetTexture { get; set; }

Remarks

Usually cameras render directly to screen, but for some effects it is useful to make a camera render into a texture. This is done by creating a RenderTexture object and setting it as Camera.targetTexture on the camera. The camera will then render into that texture.
When targetTexture is null, camera renders to screen.
When rendering into a texture, the camera always renders into the whole texture; effectively Camera.rect and Camera.pixelRect are ignored.
It is also possible to make camera render into separate RenderBuffers, or into multiple textures at once, using Camera.SetTargetBuffers function.
Additional Resources: RenderTexture, Camera.SetTargetBuffers.