Skip to content

Instantly share code, notes, and snippets.

@nickyeh97
Created March 15, 2019 10:01
Show Gist options
  • Save nickyeh97/e040cefda5694f89c6845286a6a01de3 to your computer and use it in GitHub Desktop.
Save nickyeh97/e040cefda5694f89c6845286a6a01de3 to your computer and use it in GitHub Desktop.
// OnPreRender/OnPostRender will not call in SRP
void OnPostRender()
{
//Debug.LogFormat("frameTimer : {0} , frameInterval : {1}", frameTimer, frameInterval);
if (isREC && (frameTimer += Time.deltaTime) > frameInterval)
{
frameTimer -= frameInterval;
frameBuffer.ReadPixels(camRect, 0, 0);
Debug.Log("EncodeToJPG Now");
File.WriteAllBytes(NextImgFilePath(), frameBuffer.EncodeToJPG());
}
}
string NextImgFilePath()
{
return String.Format(imgFilePathFormat, framesCount++);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment