Is there a way to access the iPhone or Android Camera from within Unity - for the purpose of creating a screenshot with overlay
// attach this to your camera
using UnityEngine;
using System.Collections;
public class TakeScreenshot : MonoBehaviour
{
private int screenshotCount = 0;
// Check for screenshot key each frame
void Update()
{
// take screenshot on touch
if (Input.touches.Length > 0)
{
string screenshotFilename;
do
{
screenshotCount++;
screenshotFilename = "screenshot" + screenshotCount + ".png";
} while (System.IO.File.Exists(screenshotFilename));
// audio.Play();
Application.CaptureScreenshot(screenshotFilename);
}
}
}
Hi!
I tried your code but I get error:
Assets/Screenshoot_button.js(1,6): UCE0001: ‘;’ expected. Insert a semicolon at the end.
If I good understod, when I toch anywhere the screen on Android device, than I can take screenshoot?
Thx
Hey,
The code seems to be doing something, but there is no photo showing up in the camera roll on iOS, where is this image being saved? is there a way to save it to the default photo director, whatever that happens to be?
Thanks
Simon.