So I want something kind of complicated. I hope this makes sense:
I have a car game where I want a button that says "TAKE PICTURE" When you click the GUI button, the game will take a picture of the current camera view. it will also make a click sound (which i have)
Below that, there will be a GUI button that says "Pictures".
When you click that, all of the images that you have taken will show up in 4 columns.
you can scroll up and down this and when you click on one of the pictures, it will expand. when you click it again, it will go back.
If you quit the game and reopen it, the images will still be there.
There should also be a button that allows you to delete an image when you expand it that says "Delete Current Image"
I know this is a lot. Sorry!
first thing first getting a texture from the camera can be done with the help of Render texture in unity.
After getting the screen shot you can use EncodeToPng function to get the byte data... You can save it as it is into the disk or u can again convert it into string64 using this function. Either way you would have to use System.IO classes to save it to disk, I suggest using StreamWriter class... similarly u can use streamReader for retriving the image back...When you press delete you can delete the file previously created....!! Hope it helpy :)
For tumb nail of the texture in the GUI you can use Graphics.DrawTexture. For expanding the image you can use the same function.
answered Jan 02, 2012 at 06:24 AM
This script lets you take screenshots and saves them next to your project, plus it draws a GUI texture of the last screenshot you took ;) Modify this for your own purpose. Add some animation and more GUI textures etc...
Put this on any object in your Hierarchy and drag any texture onto blankTexture. You can look at the "var url" in the inspector to see what file path is generated when you take a screenshot. This can be helpful for tweaking it...