RenderTexture Question (please take a look)

How would one go about storing the output of a RenderTexture in a regular Texture2D? This would be very helpful- having a Texture2D version lets you do much more with it, like storing it in a texture atlas, etc. I’ve got everything else set up and working in my script, but this one problem is stumping me. How would you get that data out of the RenderTexture and into a Texture2D?

Thanks in advance for any help/ideas.

Something like:

RenderTexture.active = myRenderTexture;
myTexture2D.ReadPixels(new Rect(0,0,myTexture2D.width, myTexture2D.height), 0, 0);
myTexture2D.Apply();
RenderTexture.active = null;

woah, thanks! Now, knowing about Texture2D.ReadPixels, I’m not sure I even need to use RenderTextures at all in this process! Thank you.

Quick question: I’m having a hard time understanding how your RenderTexture and your Texture2D are connected in that example. It seems like the ReadPixels line is just going to pull from the current MainCamera’s view, and the RenderTexture being created above is it’s own, unconnected event.

I’m sure I’m misunderstanding things. Any chance you could explain what you’ve done? Thanks either way for the help.