Making an image of a 3d scene

I would like to create a background and sprites for a 2d game and to take it from a 3d scene.
Is there a way in unity scripting to capture a screen into an image file?

I don’t mean to be rude, but you really should search the Unity docs before you ask here. In Unity, click Help>Scripting Reference. Search for ‘screenshot’ and you will find what you want.

Application.CaptureScreenshot(“Screenshot.png”);

Welcome to the forums, and be sure to mark this answer as correct if it solves your problem.

Thanks for your help. Frankly I had searched Google instead of Unity docs…