- Home /
Question by
nandonandito · May 23, 2017 at 06:35 AM ·
screenshotcapturescreenshottizen
[TIZEN] Application.CaptureScreenshot doesnt work
hi, i have to create the screenshot on my game for tizen, but my code is doesnt work for Tizen. i have to test it on windows and my code is work on editor.. but at device is doesnt work. this is my code
public void captureScreen()
{
string fileName = "FunnyCam_" + System.DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss") + ".png";
string folderPath = Application.persistentDataPath;
fileName = System.IO.Path.Combine(folderPath, fileName);
Application.CaptureScreenshot(fileName);
Application.OpenURL(folderPath);
}
have all of you try to make a screenshot script but support for all platform.
Comment
Answer by vendata · Sep 08, 2017 at 06:54 PM
Texture2D screenTexture = new Texture2D(Screen.width, Screen.height,TextureFormat.RGB24,true);
// put buffer into texture
screenTexture.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height),0,0);
screenTexture.Apply();
byte[] dataToSave = screenTexture.EncodeToPNG();
string destination = Path.Combine(Application.persistentDataPath, "ScreenShot" + ".png");
File.WriteAllBytes(destination, dataToSave);
try this!
Your answer
Follow this Question
Related Questions
Screenshot is not saving to Gallery and folder 2 Answers
Allow user to download images from game assets 2 Answers
Saving Path for Screenshot 1 Answer
How to save a screenshot to the camera roll (picture gallery)? 3 Answers
Capturing 360 Image causes to darken the image and show ghosting and artifacts 0 Answers