Created
March 15, 2019 10:01
-
-
Save nickyeh97/e040cefda5694f89c6845286a6a01de3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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