Hi!
What i mean without lag is that when i take a screenshot the application is stopped because is processing all the screenshot flow.
Is there a way to use coroutines to take screenshot but without that processing lag?
Thanks!
Hi!
What i mean without lag is that when i take a screenshot the application is stopped because is processing all the screenshot flow.
Is there a way to use coroutines to take screenshot but without that processing lag?
Thanks!
This is a very easy way, do anything you want with “screenshot”.
private static IEnumerator TakeScreenshot()
{
//wait for be draw
yield return new WaitForEndOfFrame();
int width = Screen.width;
int height = Screen.height;
Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);
// Read screen contents into the texture
tex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
tex.Apply();
//Encode to PNG
byte[] screenshot = tex.EncodeToPNG();
}
Renderator can make screenshots without lags, by them I mean no unnesesary transforms from your models:
http://forum.unity3d.com/threads/renderator.381844/
video made with it: