- Home /
 
 
               Question by 
               benjamin.cheung · Feb 16, 2016 at 01:07 PM · 
                androidunity 5savingscreenshotcs  
              
 
              How to save screenshots on Android with Unity and C#?
I'm trying to make it so that when I touch a button on my tablet, it will call the ScreenShot script component connected to the Main Camera. Am I doing this right or am I missing some code?
 public class ScreenShot : MonoBehaviour
 {    
     public static string ScreenShotName(string testbed)
     {
         return string.Format("{0}/Screenshot/{1}-{2}.png", Application.persistentDataPath, testbed, System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
     }
 
     public void OnClickSaveImage()
     {
         string name = ScreenShotName("test");
         print(name);
         Debug.Log(name);
         Application.CaptureScreenshot(name);
     }
 }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
How to save an in game screenshot directly to gallery? 1 Answer
Android Unity, Screen Recording and MediaProjection APIs - UnityPlayerActivity hang. 0 Answers
Android App start Notification 1 Answer
Troubles upgrading project from 4.6 to 5.x 0 Answers
Why is my game lagging when I use Unity's animator to change color of a image in Unity3D? 0 Answers