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 wenhua · Jan 04, 2012 at 02:44 AM · screenshot

Screenshot and use it in GUITexture Script Help

This is a working script for Cature a screenshot and save it in file

after that i create a GUITexture and put the Texture to None(Texture)

when i screenshot and save,i wanted it to display it on GUITexture>can some1 help me thx i have no idea how to write it


using UnityEngine; using System.Collections;

public class TakeScreenshot : MonoBehaviour {
private int screenshotCount = 0;

 // Check for screenshot key each frame
 void Update()
 {
     // take screenshot on up->down transition of F9 key
     if (Input.GetKeyDown("k"))
     {        
         string screenshotFilename;
         do
         {
             screenshotCount++;
             screenshotFilename = "screenshot" + screenshotCount + ".png";

         } while (System.IO.File.Exists(screenshotFilename));
         
         Application.CaptureScreenshot(screenshotFilename);
     }
     
 }

}

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
0

Answer by flamy · Jan 04, 2012 at 04:33 AM

I found a similar post have a look at this..

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 wenhua · Jan 04, 2012 at 07:44 AM 0
Share

lol got the link and some info but i dunno how to add inthis script lolT_T

avatar image flamy · Jan 04, 2012 at 09:37 AM 0
Share

after saving the screenshot you gotta retrive tht texture using WWW class check the www class example and jus change the url to ur file's address it would give u the texture back!!?

avatar image wenhua · Jan 06, 2012 at 01:55 AM 0
Share

flamy,could you pls help me with it,as i got the screenshot script above,but i doesnt know how to add in my script pls help me Thx

when i press k it will screenshot and save as adobe fireworks name (screenshot1) in

Destop>Unity3d>Assets>CharacterCustomization>CharacterCustomization

do you $$anonymous$$d help me pls or $$anonymous$$ch me step by step.Thx again

avatar image flamy · Jan 06, 2012 at 05:43 AM 0
Share
 var url = "your_path_tofile";
 var _texture:Texture;
 function LoadTexture() {
 
     var www : WWW = new WWW (url);
     yield www;
  if (www.error != null)
         Debug.Log(www.error);
   else    
     _texture = www.texture; 
 }
 
 function OnGUI()
 {
     if(_texture!=null)
       GUI.DrawTexture(Rect(0,0,512,512),_texture);
 }



this is just the basic outline add some flags and change it according to ur needs :)

avatar image wenhua · Jan 09, 2012 at 02:28 AM 0
Share

i try alr and its not working why?have you try?

my script here,help need see if these any things wrong

var imageName = "picture";

// Take a shot immediately

function Update ()

{

 if(Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.P))

 {

     Application.CaptureScreenshot(Application.dataPath + "/" + imageName + ".png");

     LoadTexture();

 }

}

var url = "C:\User\student.INSL-PC-05\Desktop\Unity3d\Assets\CharacterCustomization\CharacterCustomization\Assets\picture.png";

var _texture:Texture;

function LoadTexture() {

 var www : WWW = new WWW (url);

 yield www;

if (www.error != null)

     Debug.Log(www.error);

else

 _texture = www.texture; 

}

function OnGUI()

{

 if(_texture!=null)

   GUI.DrawTexture(Rect(0,0,512,512),_texture);

} this script got error say that error: U with this below:

var url = "C:\User\student.INSL-PC-05\Desktop\Unity3d\Assets\CharacterCustomization\CharacterCustomization\Assets\picture.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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Sending e-mails with attachments from webplayer 1 Answer

Save to a separate system folder 1 Answer

Screenshot PNG to GUITexture (NONE Texture) 0 Answers

SOLVED - Force camera to fixed aspect ratio and screenshot 1 Answer

2 issues with Facebook Sharing in Window Phone 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