GetPixels of RenderTexture

RenderTexture Inherits from Texture, as well as Texture2D, but of course the Texture2D function GetPixels can't be used on RenderTexture.

Is there a way to transfer the current frame of a given camera's RenderTexture to another texture?

this is a summary of the code I use to get the pixels from a renderTexture

Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);

// ofc you probably don't have a class that is called CameraController :P
Camera activeCamera = CameraController.getActiveCamera();

// Initialize and render
RenderTexture rt = new RenderTexture(width, height, 24);
activeCamera.targetTexture = rt;
activeCamera.Render(); = rt;

// Read pixels
tex.ReadPixels(rectReadPicture, 0, 0);

// Clean up
activeCamera.targetTexture = null; = null; // added to avoid errors 

it is taken from the scripts in this thread 2nd post

public Texture2D texture;
public RenderTexture renderTexture;
int count_x = 810;
int count_y = 8
void Start (){
texture = new Texture2D(count_x, count_y, TextureFormat.RGB24, false);

        Rect rectReadPicture = new Rect(0, 0, count_x, count_y); = renderTexture;

        // Read pixels
        texture.ReadPixels(rectReadPicture, 0, 0);
        texture.Apply(); = null; // added to avoid errors 

Directly from the docs: (1
static public Texture2D GetRTPixels(RenderTexture rt)
// Remember currently active render texture
RenderTexture currentActiveRT =;

        // Set the supplied RenderTexture as the active one = rt;

        // Create a new Texture2D and read the RenderTexture image into it
        Texture2D tex = new Texture2D(rt.width, rt.height);
        tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0);

        // Restorie previously active render texture = currentActiveRT;
        return tex;