I’m coming over from Unreal, and I was curious if there was a way to take a “high resolution screenshot” in Unity. I asked on a Discord channel, and they linked me a bunch of script lines. I don’t know anything about coding, though I could probably type out the code in Visual Studio and save it as a .cs file (I think?). I don’t know how I would use that in Unity though or anything. I was hoping somebody could walk me through the steps, as a super beginner to Unity and coding in general.
Unity doesn’t have a screenshot button or anything like that, but you can request a screenshot with a simple line of code.
For unity 2018 and earlier use Application.CaptureScreenshot(string fileName, int scaleValue)
For unity 2019 and later use ScreenCapture.CaptureScreenshot(string fileName, int scaleValue)
If you use a “scale value” of 1, your screenshot will be normal size. A “scale value” of 2 will be double size, etc.
If you can do basic scripting, you’re probably all set now. If you don’t know how to script and you just want an easy solution for screenshots, here’s what you do:
- Make an empty GameObject in the scene and select it
- In the inspector, click “Add Component”, click “New Script”, then name the script
- Double-click the script to open it
In the script, you will see an empty “Update()” function, which looks like this:
// Update is called once per frame
void Update()
{
}
Just replace that with this:
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Application.CaptureScreenshot("filename", 2);
}
}
If you are using Unity 2019 or later, replace “Application” with “ScreenCapture”.
Replace “filename” with your filename (still use “quotes”).
Replace 2 with larger numbers for higher-res images, if wanted. (2 is double-size).
After that, save the script and run the game by clicking the Play button (triangle) in the middle-top of unity, then press Spacebar to take a screenshot of your Game Window in unity.
Just wanted to say thanks, this was helpful!
The screenshot appears in the general folder of your game project.
Hello from 2021. Look like “Application.CaptureScreenshot()” has been removed.
Here is the new solution:
https://docs.unity3d.com/ScriptReference/ScreenCapture.CaptureScreenshot.html
Depending on the requirements, you could also use ‘Recorder’
https://docs.unity3d.com/Packages/com.unity.recorder@2.5/manual/RecordingRecorderWindow.html
heey I use the new one but couldn’t find the screenshots anywhere. Anyway here is something that helps.
The upscaling is useless, it can’t record a screenshot at higher resolution that the camera . I record my screenshot at scale 10 and my image is nothing different than the 1x !