

I have only used this code while in the Unity Game View so far. You can change the key to whatever you’d like and, according to the documentation, you can also change the code to take a screenshot on a mouse press. This code uses Unity’s ScreenCapture.CaptureScreenshot command (which you can see the documentation for here) to take a screenshot when you press the “P” key.

ScreenCapture.CaptureScreenshot("Screenshot") Īnd it’s as simple as that. Step 2: Insert the below code into the script: using UnityEngine Step 1: Select the main camera in your game and create a new C# script component within it. Needless to say, it wasn’t very effective. I’m not sure if it’s just because I didn’t do enough research or the program just didn’t work well with Unity but I ended up doing this song and dance of getting the player ship in open space, opening the Game bar and hoping the player didn’t get destroyed before I got an image worth capturing. So if I shot a bolt or even moved the player, the Game bar closed. Pressing any key outside of the Game bar closed it. However, when using the Game bar, I couldn’t play the game and take a screenshot at will. There was no built-in function in Unity, so I tried out Microsoft’s Game bar, a free system that I got with their OS. and found it more difficult than expected.

When writing posts for Starlight Arcade, I wanted to take in-game pictures for thumbnails, game-play images, etc. This post involves, as the title denotes, in-game screenshots in Unity. Hopefully these will help you or somebody else out there with their personal endeavors. Welcome to the first post of Tips & Tutorials! In this post category, I will offer my tried and tested solutions for things I initially found difficult to do in the game design process.
