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 r31s · Oct 19, 2011 at 12:56 PM · javascriptiosscreenshotdirectory

Javascript command for taking a screenshot then saving it to a folder directory??

My question is basically what the title is, I'm new to Unity and learning Javascript. All help will be appreciated. for iOS platform

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 syclamoth · Oct 19, 2011 at 01:02 PM 0
Share

Don't use titles as the actual question, it's messy. Take the time to write it properly in the post.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by syclamoth · Oct 19, 2011 at 01:06 PM

Funnily enough, if you'd searched for 'screenshot' in the unity scripting reference, this would have been the first hit. Use the API reference! It's there to help you.

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 r31s · Oct 19, 2011 at 01:14 PM 0
Share

I have the script for the screenshot itself, but I want to run it on my iOS Device and save it to the Photo library. I'm unsure on what the commands are to put the image take to the directory - private/var/root/$$anonymous$$edia/DCI$$anonymous$$/100APPLE (or ~/$$anonymous$$edia/DCI$$anonymous$$/100APPLE)

avatar image syclamoth · Oct 19, 2011 at 01:26 PM 0
Share

Well then I take it back. Could you please clarify your question so that it's obvious that you're talking about iOS here? It's kind of more complicated, then.

avatar image r31s · Oct 19, 2011 at 02:09 PM 0
Share

Thank you, I've amended to indicate iOS.

avatar image syclamoth · Oct 19, 2011 at 11:01 PM 0
Share

That really wasn't a very good amendment.

avatar image jahroy · Oct 19, 2011 at 11:15 PM 1
Share

I could be wrong, but I think you need to write native code to achieve this. I'm pretty sure you're only allowed to write to a specific directory on iOS devices.

If I am wrong (and this can be done in Unity) I'd love to know how!

avatar image
0

Answer by r31s · Oct 19, 2011 at 02:13 PM

 // The folder we place all screenshots inside.
 // If the folder exists we will append numbers to create an empty folder.
 var folder = "ScreenshotFolder";
 
 private var realFolder = "";
 
 function OnGUI () {
   if (GUI.Button (Rect (10,10, 100, 50),"take screenshot")) {
 captureScreen();
  }
 }
 
 function Start () {
    // Find a folder that doesn't exist yet by appending numbers!
    realFolder = folder;
    count = 1;
    while (System.IO.Directory.Exists(realFolder)) {
        realFolder = folder + count;
        count++;
    }
    // Create the folder
    System.IO.Directory.CreateDirectory(realFolder);
 }
 
 
 function captureScreen () {
    // name is "realFolder/0005 shot.png"
    var name = String.Format("{0}/{1:D04} shot.png", realFolder, Time.frameCount );
 
    // Capture the screenshot
    print("Screenshot taken");
 Application.CaptureScreenshot (name);
 }


I'm using this script to try and link up onGUI to capture screenshot function so that on the iOS images are saved to the photo library.

Hope this makes more sense as to my problem.

Comment
Add comment · Show 4 · 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 Ludiares.du · Oct 19, 2011 at 02:22 PM 0
Share

Format your code with the little 0101 button when writing your post(or editing). That will help other read your code

avatar image r31s · Oct 19, 2011 at 02:33 PM 0
Share

Thank you for that.

avatar image siberman · Feb 18, 2012 at 02:33 AM 0
Share

Hey there, very interested as to whether you've been able to get this working?

avatar image jahroy · Feb 18, 2012 at 04:24 AM 0
Share

I'm almost positive that it is NOT possible to write to the Camera Roll without writing your own native code. That means you have to write Objective C code.

There are only a couple directories that are accessible from within Unity. The Camera Roll folder is not one of them.

This question has been asked many many times. I've ready many forum posts and Unity Answers questions on the subject. I've never seen anybody offer a way to do it without using Objective C.

Notice that I made the same comment back in October and it was up-voted.

avatar image
0

Answer by r31s · Feb 18, 2012 at 03:01 PM

Yes we did manage to get it working siberman, jahroy is right that it implies native code, great plugin worth investing in is prime 31 plugins as it does everything you need plus extra things too, there support is quick responce too.

Hope this helps. Reis.

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

Automatically load asset bundles on start from cache 0 Answers

A node in a childnode? 1 Answer

Make an object move in the direction of touch 0 Answers

how do you make an object rotate on ios with your finger 3 Answers

Unity Push notification 0 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