Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ScreenShots.js
- // Author : Christopher Cullen
- // Date : 02/02/2013
- // Description :
- // This script will allow you to take screenshots while in game.
- // How to use.
- // 1) Drag the script on to anything that is in the level. (i.e Main Camera etc)
- // 2) Set the name of the screenshot in the inspector. ( if not it will assign one for you).
- // 3) when ingame press F12 to take the screenshot.
- // 4) go to the directory where your project is and in the root folder you will your screenshots.
- // Make sure to set a name or it will use the default title.
- public var screenshotName : String = "";
- private var defaultName : String = "Default";
- // fucntion Update()
- // This function will check on every frame it the F12 button is pressed
- // and if it is pressed it will check the name that it has to output, if
- // it does not have a name it will assign the name default and capture
- // the frame and saves it to the games directory
- function Update()
- {
- if(Input.GetKeyDown(KeyCode.F12))
- {
- if(screenshotName == "")
- {
- screenshotName = defaultName;
- }
- time = System.DateTime.Now.ToString("_hh_mm_ss");
- date = System.DateTime.Now.ToString("_dd_MM_yyyy");
- Application.CaptureScreenshot(screenshotName + time + "" + date + ".png" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment