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 /
avatar image
0
Question by ergiomarxD · Mar 04, 2014 at 05:46 PM · c#screenshot

Screenshot multiple

Does anyone know how I can screenshot different scenes in the mobile phone.? I got this script but it only allow MAXIMUM OF ONE SCREENSHOT only, so everytime I tried to perform the screenshot it doesn't save anymore :(

 void OnGUI() {
     if (GUI.Button (new Rect(50,50,150,30), "Capture")) {
         string filename = "shot.png";
         Application.CaptureScreenshot(filename);
  
         if (QCARRuntimeUtilities.IsPlayMode()) {
             // if in PlayMode, the screenshot will be saved
             // to the project directory
             Debug.Log ("Saved screenshot to " + filename);
         }
         else {
             // if running on Device, the screenshot will be saved
             // to the Application.persistentDataPath directory
             Debug.Log ("Saved screenshot to " + Application.persistentDataPath + "/" + filename);
         }
     }
 }
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by robertbu · Mar 04, 2014 at 05:53 PM

Actually it allows multiple screen shots, but since you are always using the same file name, the last one taken is the only one you see. Try creating a unique file name each time it is called:

 string filename = "shot"+Time.frameCount+"png";  

Note is a solution for a single session. You'll have to come up with something else if this is for an end user or if you want to have it for multiple sessions. You could keep a shot count using PlayerPrefs and use that for example.

Comment
Add comment · Show 5 · 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 ergiomarxD · Mar 05, 2014 at 04:32 PM 0
Share

what would be the codes fort the multiple session ? :/

avatar image robertbu · Mar 05, 2014 at 04:57 PM 0
Share

You could do something like this (untested):

 int shotsTaken = PlayerPrefs.GetInt("ShotsTaken", 0);
 shotsTaken++;
 PlayerPrefs.SetInt("ShotsTaken", shotsTaken);
 string filename = "Shot_"+shotsTaken+".png";



avatar image ergiomarxD · Mar 05, 2014 at 06:48 PM 0
Share

if I want to save the screenshot made in specific folder of the phone how will I do it?thank you Sir.

avatar image perchik · Mar 05, 2014 at 06:48 PM 0
Share

Please be careful to post comments on this answer as comments to this answer and not as a new answer.

avatar image robertbu · Mar 05, 2014 at 07:28 PM 0
Share

If I want to save the screenshot made in specific folder of the phone how will I do it?thank you Sir.

I don't know for sure and Android and iOS may be different. There are sandboxing issue, so you cannot put them just anywhere. I suspect that your screen shots are stored in Application.persistentDataPath. You should be able to store them in a subfolder by specifying a path in the file name:

  string filename = "ScreenShots/Shot_"+shotsTaken+".png";

Edit: I'm not at a place I can test out how things work at the moment. Application.CaptureScreenshot says nothing about default path, so you may have to supply the full path for use on the phone:

 string filename = Application.persistentDataPath+"/ScreenShots/Shot_"+shotsTaken+".png";

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

Screenshot and save 0 Answers

Distribute terrain in zones 3 Answers

screenshot 0 Answers

Multiple Cars not working 1 Answer

A node in a childnode? 1 Answer


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