Camera.targetTexture

切换到手册
public RenderTexture targetTexture ;

描述

目标渲染纹理。

一般情况下,摄像机直接渲染到屏幕,但对于某些效果, 将摄像机渲染到纹理会非常有用。为此,可以创建一个 RenderTexture 对象, 在摄像机上将其设置为 targetTexture。随后,摄像机就会渲染到 该纹理。

当 targetTexture 为 null 时,摄像机渲染到屏幕。

当渲染到纹理时,摄像机始终渲染到整个纹理中;实际上, rectpixelRect 将被忽略。

也可以使用 SetTargetBuffers 函数,让摄像机渲染到单独的 RenderBuffers, 或同时渲染到多个纹理。

另请参阅:RenderTextureSetTargetBuffers