📜  rendertexture 到 texture2d - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:01.645000             🧑  作者: Mango

代码示例1
Texture2D toTexture2D(RenderTexture rTex)
{
    Texture2D tex = new Texture2D(512, 512, TextureFormat.RGB24, false);
    // ReadPixels looks at the active RenderTexture.
    RenderTexture.active = rTex;
    tex.ReadPixels(new Rect(0, 0, rTex.width, rTex.height), 0, 0);
    tex.Apply();
    return tex;
}