Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by tenthplanet0 · Feb 04, 2013 at 12:16 PM · savedisplayscreenshotcapturescreenshotloadassetatpath

capturing screen shot, and showing the captured image on screen

Hiii everyone, I have the requirement of capturing screen shot, saving it and accessing to show it on screen. How can I do this? please help out this new bee.... Thanks in advance

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

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Unity_gamer · Feb 04, 2013 at 01:04 PM

Hi,

You can use "Application.CaptureScreenshot" to capture Image in Unity. you can refer the below link for reference. http://docs.unity3d.com/Documentation/ScriptReference/Application.CaptureScreenshot.html

 public static string screenshotFilename = "screenshotName.png";
 
 void Start() {
     Application.CaptureScreenshot( screenshotName );
 }
 
 //use this to  find the Path of the Image
 
 var pathToImage = Application.persistentDataPath + "/" + screenshotName;

Try this out and post the result here.

Thanks

Comment
Add comment · Show 9 · 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 tenthplanet0 · Feb 04, 2013 at 01:22 PM 0
Share

Hi, Here you go with my problem exactly 1. I am capturing screen shot by Application.CaptureScreenshot("path"+screenshot1.png); 2. Now need to fetch captured screen shot instantly & i am doing this by curSnap = Resources.Load("screenshot1"); I am getting null in curSnap if I access that screenshot instant but I am able to fetch once I close the engine & restart it.

$$anonymous$$y requirement is to get that captured snap as soon as I save in hard disk.

I am just bit to acheive that. Pls help me out Thanks

avatar image Unity_gamer · Feb 04, 2013 at 02:06 PM 0
Share

u tried using "Application.persistentDataPath" ? use this link for reference. http://docs.unity3d.com/Documentation/ScriptReference/Application-persistentDataPath.html

avatar image robertbu · Feb 04, 2013 at 04:34 PM 0
Share

To load an image back in use the WWW class. If you are trying to speed up that process, just don't yield. It's a bit ugly but:

         Application.CaptureScreenshot ("e:/foo.png");
         WWW www = new WWW("file://e:/foo.png"); 
         while (!www.isDone)
             ;
         www.LoadImageIntoTexture((Texture2D)renderer.material.mainTexture);

You can save the image anywhere you have permission. If your target platform is controlled in some way, do as @Unity_gamer suggests and use persistentDataPath.

avatar image Unity_gamer · Feb 05, 2013 at 06:46 AM 0
Share

@robertbu Thanks for correcting me ..:) I used this in ios implementation , and it worked fine for me.

avatar image tenthplanet0 · Feb 25, 2013 at 05:19 PM 0
Share

Thanks developers. I found the alternate solution using "WWWForm". Thanks for your care and help

Show more comments
avatar image
1

Answer by Aqibsadiq · Apr 12, 2016 at 04:35 AM

@tenthplanet0 Here is simple Code for capturing screen shot, and showing the captured image on screen

This Code is For Andriod and IPhone.For PC Just Give the Image Path

 public RawImage image;
 void Start()
 {
       Photo();
       Invoke("GetPhoto",1f);
 }
 
 public void Photo()
     {
         Application.CaptureScreenshot(Variables.ImageName);
     }
 
 public void GetPhoto()
     {    
         #if !UNITY_EDITOR
         string url = Application.persistentDataPath +"/"+Variables.ImageName;
         var bytes = File.ReadAllBytes( url );
         Texture2D texture = new Texture2D( 73, 73 );
         texture.LoadImage( bytes );
         image.texture= texture ;
         #endif
     }

Comment
Add comment · Show 2 · 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 fonko · Sep 29, 2018 at 02:56 AM 0
Share

what is Variables.ImageName?

avatar image hotchick · Nov 25, 2021 at 02:34 PM 0
Share

thanks it worked!

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

14 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

Related Questions

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

Application.CaptureScreenshot on a Texture2D? 1 Answer

Save to a separate system folder 1 Answer

Sending email with attachment 3 Answers

How can I take screenshot in an unity application and save it to device's gallery (for android and ios both)? 2 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