4

How do you take a screenshot of the game view without external sources like Snipping Tool or Lightshot, like to take a screenshot with the resolution i configured in my Game View window. Like i want to take a 4k screenshot for my desktop, store page or share with friends.

andAnother1
  • 168
  • 1
  • 12

2 Answers2

5

Unity has a screenshot tool already. It's called Recorder and doesn't require any coding.

  1. In Unity, go to the Window menu, then click on Package Manager
  2. By default, Packages might be set to "In Project". Select "Unity Registry" instead
  3. Type "Recorder" in the search box
  4. Select the Recorder and click Install in the lower right corner of the window
  5. That's about all you need to get everything set up and hopefully the options make sense. The main thing to be aware of that setting "Recording Mode" to "Single" will take a single screenshot (with F10)
MXMLLN
  • 1,387
  • 2
  • 12
  • 12
4

It's suprisingly easy, at the end you capture a screenshot off everything you see in the game view, if you want to dont show the ui, just disable the canvas for it.

    private void Update(){
        if(Input.GetMouseButtonDown(0)){ // capture screen shot on left mouse button down

            string folderPath = "Assets/Screenshots/"; // the path of your project folder

            if (!System.IO.Directory.Exists(folderPath)) // if this path does not exist yet
                System.IO.Directory.CreateDirectory(folderPath);  // it will get created
            
            var screenshotName =
                                    "Screenshot_" +
                                    System.DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss") + // puts the current time right into the screenshot name
                                    ".png"; // put youre favorite data format here
            ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(folderPath, screenshotName),2); // takes the sceenshot, the "2" is for the scaled resolution, you can put this to 600 but it will take really long to scale the image up
            Debug.Log(folderPath + screenshotName); // You get instant feedback in the console
        }
    }
derHugo
  • 83,094
  • 9
  • 75
  • 115
andAnother1
  • 168
  • 1
  • 12