Create a custom SceneCapture2D

I wanted to create a custom class which can be used in the Editor and then create an image stream which can be used somewhere else.

From the editor itself, I can use a SceneCapture2D, and stream to a TextureRenderTarget2D. But if I want to create a custom class, how do I do it?

What I tried (can someone tell me how to properly paste code here?):



but I do not know how to set the resolution of the render target, and I was not able to figure out how I can actually set the texture target (the code as pasted won’t compile).

Has anyone code of this behaviour I want?