Screenshot Helper

Screenshot Helper

I often find myself needing to grab a screenshot or two from my Unity applications, and often ending up using PrintScreen or the (admittedly very handy!) Snipping Tool.

To avoid this slightly awkward manual process I’ve put together a very simple Screenshot component.

You can define which key takes the screenshot (default F12) and a setting to allow super resolution shots to be taken (default 100%, up to 400%)

(The latest version can also be bound to the Unity Input manager via the inputButton field if required.)

I’ve tested 400% super resolution with my plucky old 1080p panel and it creates an 8k image without issue – 400% at 4k native will produce a 16k image which I guess might work – if you are brave enough to try this, please let me know!

Note: Unity MonoBehaviours should always be in a file where the name matches the class name – put this code in a file named Screenshot.cs

Without further ado, here’s the code!

The shots are saved as PNG files into a Screenshots folder in the root of your project (up one from the Assets folder to prevent them being automatically included in your project!)

The names are a long number based on the current time – it’s not the prettiest naming system, but it means the shots are in the correct order by default when viewing the folder.

Just add the Screenshot component to any GameObject (I tend to make a new game object for it, just to keep it easy to find) and press the selected key when running the game, either in the editor or in the build.

It’s saved me a bit of time recently, so I thought I’d share it with you! 🙂