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 Kamuiyshirou · May 02, 2014 at 07:22 PM · androidimagescreenshot

[ANDROID]How to load images from a certain folder after a screenshot?

Friends, let's move! Question ANDROID! I have a problem. If there is a solution, everyone will benefit

Counted after 3 seconds, I can do a print screen of the game and also save this image on your device> Android / data / com.xxx.xxx / File / screenshot.png file

IS A SUCCESS!

My problem is: HOW TO VIEW THIS PICTURE AFTER THE SCREENSHOT?

MY SCRIPT:

 using UnityEngine;
 using System.Collections;

 public class ScreenShotANDPrint : MonoBehaviour {
 public float time = 3; // Set your time.
 public GameObject screenshotImage; // Set your image(Sprite Renderer, etc,...).
 public int NumberStage;
 public string url = "jar:file://" + Application.dataPath + "/assets/" + "/Screenshot.png";
 public Texture2D texturas;



 void Start(){
     screenshotImage.active = false;
     WWW www = new WWW("jar:file://" + Application.dataPath + "/assets/" + "/Screenshot.png");
     StartCoroutine(registerFunc(www));
 }


 //DEBUGA O "ERROR LINHA 34"
 IEnumerator registerFunc(WWW www)
 {
     yield return www;
     if (www.error == null)
     {
         Debug.Log("OK - CountTime");
         texturas = www.texture;
     }
     else
     {
         Debug.Log("ERROR");
     }
 }

 void Update () {
     //Application.CaptureScreenshot(Application.persistentDataPath+"/Frame.png");
     //Application.CaptureScreenshot("Screenshot.png");
     time -= Time.deltaTime;
     int myInt = (int)time;
                 
 }




 void OnGUI(){

     WWW www = new WWW (url);
     WWW loadingImageWWW = new WWW("jar:file://" + Application.dataPath + "/assets/" + "/Screenshot.png");


     int myInt = (int)time;
     GUI.Box(new Rect(Screen.width/2,Screen.height/2,100,25),myInt.ToString());
     if(myInt == 0 )
     {
         time = 0;
         //This is obsolete, but it works.
         screenshotImage.active = true;

         //Aqui ele bate a foto da tela
         Application.CaptureScreenshot("Screenshot.png");

         if (loadingImageWWW.isDone)
         {   

        / / Here my textures should appear, but they appear as a white box and a red mark.

             GUI.Button(new Rect(Screen.width/2 - 30,Screen.height/3,165, 30),loadingImageWWW.texture);    
             GUI.DrawTexture(new Rect(300,0,100,100),www.texture);
             GUI.DrawTexture(new Rect(300,100,100,100),loadingImageWWW.texture);
         }

         if(GUI.Button(new Rect(Screen.width/2 - 30,Screen.height/3,165, 30),url)){
         Application.LoadLevel(NumberStage);
             
         }            
         }
 
     }

 }
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
2

Answer by Oribow · May 02, 2014 at 07:39 PM

Take a look here. "How to make and save an Android Screenshot First, according to this post, androids have problems encoding to PNG. This post provided a link to an alternative jpg encoding.

Second, to view the screenshot from the android file manager, the file path needs to be set using Application.persistentDataPath . More in this post."

Accept if it helps you.

Comment
Add comment · Show 1 · 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 Kamuiyshirou · May 02, 2014 at 07:44 PM 0
Share

I will study it.

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

Share image in Unity Game on Android devices error 2 Answers

Weird behavior when downloading to android 0 Answers

How to load image from android gallery 0 Answers

Loading 8192x8192 textures at runtime on android 0 Answers

Save Image to Android Photo gallery 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