Advertisement
diegographics

Untitled

May 10th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. // Capture frames as a screenshot sequence. Images are
  5. // stored as PNG files in a folder - these can be combined into
  6. // a movie using image utility software (eg, QuickTime Pro).
  7.  
  8. public class HydraRenderer : MonoBehaviour
  9. {
  10.     // The folder to contain our screenshots.
  11.     // If the folder exists we will append numbers to create an empty folder.
  12.     public string folder = "ScreenshotFolder";
  13.     public int frameRate = 25;
  14.     void Start()
  15.     {
  16.         // Set the playback framerate (real time will not relate to game time after this).
  17.         Time.captureFramerate = frameRate;
  18.  
  19.         // Create the folder
  20.         System.IO.Directory.CreateDirectory(folder);
  21.     }
  22.  
  23.  
  24.     void Update()
  25.     {
  26.         // Append filename to folder name (format is '0005 shot.png"')
  27.         string name = string.Format("{0}/{1:D04} shot.png", folder, Time.frameCount);
  28.  
  29.         // Capture the screenshot to the specified file.
  30.         Application.CaptureScreenshot(name);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement