Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Sixakoo_ · Jul 08, 2011 at 04:58 AM · textureinstantiateresourcesscreenshotsnapshot

Is it possible to call texture from a ScreenShot into GUI Texture In Unity Build?

Hello,

I have a question to ask whether Unity can actually call or instantiate images recently taken from the scene itself using the "Application.CaptureScreenshot" in a Build. I've already tried inside the editor to call the images from the screenshots using the "Resources.LoadAll" code, and it worked! Except for these 2 problems:-

  1. Newly taken snapshot is not imported into asset immediately and it requires the Unity to refresh its assets folder and may take a while.

  2. When build player, "Resources" folder is compiled (I think) and won't call objects outside the compiled folder. The images of the screenshot is stored at the "Resources" then "Texture" folder, but doesn't work like it did inside the editor.

I already checked the path inside data folder of the build, and confirm that it's correct. I just want to make sure that it is possible to do that in Unity. Please tell me whether it's possible or not. Thank You.

Edited-

Error:

"You are trying to load data from a www stream which had the following error when downloading. Could not resolve host: C:; Host not found"

My Code:-

 function Start ()
 {
 
     var go = new GameObject.CreatePrimitive(PrimitiveType.Cube);
     //var Location = "http://mytutorblog.org/wp-content/uploads/2011/05/Prepare-for-a-test.jpg";
     //var Location    "C:\Documents and Settings\Administrator\Desktop\ScreenShot1.png"
     var Location = Application.dataPath + "/Screenshots/" + "ScreenShot1.png";    
     
             go.renderer.material.mainTexture = new Texture2D(4, 4, TextureFormat.DXT1, false);
             while(true) 
             {
                 // Start a download of the given URL
                 var www = new WWW(Location);
 
                 // wait until the download is done
                 yield www; 
                 
                 // assign the downloaded image to the main texture of the object
                 www.LoadImageIntoTexture(go.renderer.material.mainTexture); 
             }
     
 }
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
Best Answer

Answer by DaveA · Jul 08, 2011 at 02:19 PM

Use the WWW class using file:// prefix on the file name. Not for web player.

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 Sixakoo_ · Jul 11, 2011 at 05:25 AM 0
Share

Thanks for the answer, sorry for the late reply. I've tried using the WWW "LoadImageIntoTexture" but I got an error "You are trying to load data from a www stream which had the following error when downloading. Could not resolve host: C:; Host not found". As I have no clue how to fix this, I've include my code in the question above.

avatar image Sixakoo_ · Jul 11, 2011 at 07:55 AM 0
Share

Okay, I've figured it out. I should put the file:// before the path and change all of the backslash to slash, sorry for not realizing what DaveA said earlier.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Dynamic Material & Textures 1 Answer

Using Screenshot as Texture 4 Answers

Sending e-mails with attachments from webplayer 1 Answer

Screenshot PNG to GUITexture (NONE Texture) 0 Answers

How do I reduce resource cost of textured quads? 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