Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Dec 11, 2014 at 06:14 AM by Prasanna for the following reason:

Found it own

avatar image
3
Question by Prasanna · Dec 03, 2014 at 07:46 AM · screenshotgallerycapturescreenshot

Saving Path for Screenshot

Hi, i have a script for taking screen and save into default location. But i want to make that location manually, where can i add that in this script and now i can't see those screenshots in gallery. I want to see that screenshot into my gallery too. Thanks in advance, here is the script.

 using UnityEngine;
 using System.Collections;
 
 public class Capture : MonoBehaviour 
 {
     private int Screen_Shot_Count = 0;
     public GUITexture Capture_Model;
 
     void Update()
     {
         if (Input.touches.Length > 0)
         if(Capture_Model.HitTest (Input.GetTouch(0).position))
         {
             string Screen_Shot_File_Name;
             do
             {
                 Screen_Shot_Count++;
                 Screen_Shot_File_Name = "Screenshot_" + Screen_Shot_Count + ".png";
                 
             } 
             while (System.IO.File.Exists(Screen_Shot_File_Name));
 
             Application.CaptureScreenshot(Screen_Shot_File_Name);
         }
     }
 }

Does anyone know how to do this?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Prasanna · Dec 08, 2014 at 09:24 AM 0
Share

Anyone there to solve this issues?

1 Reply

  • Sort: 
avatar image
4
Best Answer

Answer by Prasanna · Dec 11, 2014 at 06:13 AM

Finally found a solution.

 using UnityEngine;
 using System.Collections;
 
 public class Capture : MonoBehaviour 
 {
     // Store more screenshots...
     private int Screen_Shot_Count = 0;
     // Screenshot taking by touch the button.
     public GUITexture Capture_Model;
     // Check the Shot Taken/Not.
     private bool Shot_Taken = false;
     // Name of the File.
     private string Screen_Shot_File_Name;
 
     void Update()
     {
         if (Input.touches.Length > 0)       
         // Finger hit the button position.
         if(Capture_Model.HitTest (Input.GetTouch(0).position))
         {
             if (Input.GetTouch(0).phase == TouchPhase.Began)
             {
                 // 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);
                 Shot_Taken = true;
             }
         }
         if(Shot_Taken == true)
         {
             string Origin_Path = System.IO.Path.Combine(Application.persistentDataPath, Screen_Shot_File_Name);
             // This is the path of my folder.
             string Path = "/mnt/sdcard/DCIM/Inde/" + Screen_Shot_File_Name;
             if(System.IO.File.Exists(Origin_Path))
             {
                 System.IO.File.Move(Origin_Path, Path);
                 Shot_Taken = false;
             }
         }
     }
 }

This will help someone.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image raj231 · Jan 29, 2015 at 07:55 AM 0
Share

Hi Prasanna, Does it works on android? I've tried your code but it's notworking.

 if (GUI.Button(new Rect(Screen.width-85,Screen.height-(Screen.height-80),80,80), Zoom_Tex,camera_icon_style)) {
                  
                      Screen_Shot_File_Name = model.name + System.DateTime.Now.ToString("__yyyy-$$anonymous$$$$anonymous$$-dd") + ".png";
                      Application.CaptureScreenshot(Screen_Shot_File_Name);
                      Shot_Taken = true;
                      //Debug.Log("path save is "+Screen_Shot_File_Name);
                      
  
                  }
                  if(Shot_Taken == true)
                  {
                      string Origin_Path = System.IO.Path.Combine(Application.persistentDataPath, Screen_Shot_File_Name);
                      Debug.Log("Origin_Path save is "+Origin_Path);
  
                      // This is the path of my folder.
                  
                      string Path = "/mnt/sdcard/DCI$$anonymous$$/Inde/" + Screen_Shot_File_Name;
                      Debug.Log("Path save is "+Path);
                      if(System.IO.File.Exists(Origin_Path))
                      {
                          System.IO.File.$$anonymous$$ove(Origin_Path, Path);
                          Debug.Log("Path_move save is "+Path);
                          Shot_Taken = false;
                      }
                  }
avatar image Prasanna · Jan 29, 2015 at 08:02 AM 0
Share

Tell me exactly, which is not working?, Is that having problem with taking screenshot? or store the folder?. You have to remove the Inde from your path or you have to create a folder name called Inde in the path "/mnt/sdcard/DCI$$anonymous$$/"

avatar image rameshkumar Prasanna · May 02, 2016 at 11:12 AM 0
Share

is it working fine or what ? actually i have the source code like

public void SaveScreenShot() { // 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-$$anonymous$$$$anonymous$$-dd") + ".png"; Application.CaptureScreenshot(Screen_Shot_File_Name); Shot_Taken = true;

    if (Shot_Taken == true)
    {
        string Origin_Path = System.IO.Path.Combine(Application.persistentDataPath, Screen_Shot_File_Name);
        // This is the path of my folder.
        string Path = "/mnt/sdcard/DCI$$anonymous$$/Camera/" + Screen_Shot_File_Name;
        if (System.IO.File.Exists(Origin_Path))
        {
            System.IO.File.$$anonymous$$ove(Origin_Path, Path);
            Shot_Taken = false;
        }
    }
 }

i am not getting any pics do i need to change anything in this source or what let me know?

Follow this Question

Answers Answers and Comments

25 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Screenshot is not saving to Gallery and folder 2 Answers

How to save a screenshot to the camera roll (picture gallery)? 3 Answers

Upload image to server and display it for others? 0 Answers

Capturing 360 Image causes to darken the image and show ghosting and artifacts 0 Answers

Share Button 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges