Beispiel #1
0
 void Snapshot()
 {
     snapshots.Add(CaptureTheGIF.Snapshot(width, height));
     if (snapshots.Count > frames)
     {
         RenderTexture.ReleaseTemporary(snapshots[0]);
         snapshots.RemoveAt(0);
     }
 }
Beispiel #2
0
 void Awake()
 {
     if (instance)
     {
         Debug.LogError("there is already an instance of CaptureTheGIF");
         Destroy(gameObject);
         return;
     }
     instance = this;
 }
Beispiel #3
0
 void Update()
 {
     if (Time.time >= lastSnapshot + 1 / frameRate)
     {
         lastSnapshot = Time.time;
         Snapshot();
     }
     if (Input.GetKeyDown(key))
     {
         var file = CaptureTheGIF.MakeFile(dir, name);
         CaptureTheGIF.Instance.MakeGif(snapshots.ToList(), 1 / frameRate, file, true);
         snapshots.Clear();
     }
 }
Beispiel #4
0
 void Awake()
 {
     if (instance) {
         Debug.LogError("there is already an instance of CaptureTheGIF");
         Destroy(gameObject);
         return;
     }
     instance = this;
 }