- Home /
Found the mistake.
Screenshot is not save properly into the folder.
Hi guys, am using Application.persistentDataPath to save my screenshot into my phone. I created one folder when i start the application, so i choose that folder for my destination path for saving my screenshot, but it's not working everytime it shows the screenshot under the data path only. where i miss the point for this condition?
This line is for save path in android:
 if(Shot_Taken == true)
         {
             Origin_Path = System.IO.Path.Combine(Application.persistentDataPath, Screen_Shot_File_Name);
             // This is the path to save screenshot.
             File_Path = "/mnt/sdcard/DCIM/Augmented Reality/" + Screen_Shot_File_Name;
             if(System.IO.File.Exists(Origin_Path))
             {
                 System.IO.File.Move(Origin_Path, File_Path);
                 Shot_Taken = false;
             }
         }
This line i used splashscreen scene in my application:
 private void Awake()
     {
         System.IO.Directory.CreateDirectory ("/mnt/sdcard/DCIM/Augmented Reality");
     }
and sometimes my screenshot is not taking properly, if i take 5 screenshots it will show only 2 or 3.
This is for taking screenshots:
 public void OnCaptureScreen()
     {
         Active = false;
         // Increament the screenshot count.
         Screen_Shot_Count++;
         // Save the screenshot name as Screenshot_1.png, Screenshot_2.png, with date format...
         Screen_Shot_File_Name = "Screenshot__" + Screen_Shot_Count + System.DateTime.Now.ToString("__yyyy-MM-dd") + ".png";
         Application.CaptureScreenshot(Screen_Shot_File_Name);
         StartCoroutine (Active_Objects());
     }
Some debug info would be useful from your 1st code snippet i.e. if(Shot_Taken == true){}:
- Debug.Log(Origin_Path) //just after Origin_Path gets set 
- Debug.Log("Origin_Path Exists") //1st line inside the if(System.IO.File.Exists(Origin_Path)) statement 
Note: Path.Combine() needs a $$anonymous$$imum of .net framework 4, but I think that Unity/$$anonymous$$ono does not support that. I'm not sure about this, but I remember having some problems with using .net framework 4 calls, and after endless googling decided not to use it.
Did you already read this?
http://answers.unity3d.com/questions/204372/saving-screenshots-to-android-gallery.html
How can i use debug option when i run application into my phone, because my unity remote is not working. @pako
Ins$$anonymous$$d of debug.log you can show a relevant message using the GUI.
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                