- Home /
Take screenshots in game?
I want to have a button on the canvas that when clicked, it takes a screenshot (I guess it would be the main camera in this case), and saves it to the desk top (with a name like sreenshot1, screenshot2, etc etc. Does anyone have code for this or can explain how I could write it? Thanks!
Comment
Answer by unity_OWzFUJQKZ_tS3w · Jan 02, 2018 at 07:30 AM
I'm getting the error: Assets/Screenshot.cs(13,13): error CS0103: The name `ScreenCapture' does not exist in the current context
Here's my code (I'm not exactly sure how to utilize the CaptureScreenshot function exactly, a little confused).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Screenshot : $$anonymous$$onoBehaviour
{
void Update()
{
if (Input.Get$$anonymous$$eyDown("k"))
ScreenCapture.CaptureScreenshot("SomeLevel");
}
}
How would I go about specifying the location of it? I want it to be on the desktop