Screenshot on Android
I'm sorry Application.CaptureScreenshot(Application.persistentDataPath);
it simply does not do anything. It does not save the photo anywhere I can find it. There's something else I need to be doing here, I don't know what it is. Maybe there's something I'm forgetting, but it works perfectly when running the unity program on my PC. I doesn't work at all on Android.
I found out that persistentDataPath was looking for a sdCard which is not compatible with the android tablet I was using.
Answer by Odyssee · Jul 08, 2016 at 08:26 AM
Try this; go in
- Build Settings 
- > Player Settings 
- ---> Android 
- -----> Subpanel Other settings 
- -------> Write access : Set to External (SDCard) 
no, the tablets I'm using Google's Nexus and Google Pixel are both solid and have no opening for an SD card. So what I figured out was that it's taking a screenshot, looking for an SD card to save it on, seeing that none exists, then just does nothing.
Answer by billingsleyjon · Jul 13, 2016 at 12:14 AM
Application.screenshot(); just doesn't work for me. you also might want to call the manuallycodedScreenshot inside an iEnumerator.
If someone is experiencing this issue here's how to fix it:
     Texture2D screencap;
     string screenshotPath; 
 
 void Start() {
         screencap = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
         screencap.Apply();
 
 
 screenshotPath = (runningOnPC ? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
             : Application.persistentDataPath) + "/TSM_Screenshots/";
 }
 
 
 void manuallyCodedScreenshot()
     {
         screencap.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, true);
         screencap.Apply();
 
         byte[] screenshotEncodedinBytes = screencap.EncodeToPNG();
         File.WriteAllBytes(screenshotPath, screenshotEncodedinBytes);
 
 
     }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                