Guest User

Untitled

a guest
Jan 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. private void TakeScreenshot() {
  2. string timeStamp = DateTime.Now.ToLongTimeString();
  3. timeStamp = timeStamp.Remove( timeStamp.IndexOf( " " ) );
  4. timeStamp = timeStamp.Replace( ":", "" );
  5.  
  6. mScreenshotPath = mDataPath + "/Screenshots/" + mDateString + "/";
  7. mScreenshotTexture.ReadPixels( new Rect( 0f, 0f, Screen.width, Screen.height ), 0, 0 );
  8.  
  9. byte[] bytes = mScreenshotTexture.EncodeToPNG();
  10.  
  11. if( !Directory.Exists( mScreenshotPath ) ) {
  12. Directory.CreateDirectory( mScreenshotPath );
  13. }
  14.  
  15. mCachedScreenshots.Add( mScreenshotPath + mLevelName + "_" + "Screenshot_" + timeStamp + ".png", bytes );
  16. }
Add Comment
Please, Sign In to add comment