- Home /
This question was
closed Nov 08, 2012 at 03:34 PM by
Kiloblargh for the following reason:
Problem is not reproducible or outdated
Question by
Kiloblargh · Oct 18, 2012 at 10:18 PM ·
texture2dscreenshotreadpixelsblank
What's wrong with my screenshot function?
setupScript.screenshot = new Texture2D(Screen.width,Screen.height,TextureFormat.RGB24,false);
yield new WaitForEndOfFrame(); // to ward off a "...while not in drawing frame" error
setupScript.screenshot.ReadPixels(Rect(0,0,Screen.width,Screen.height),0,0,false);
I paused the game and checked out SetupScript's "screenshot" variable in the inspector right after this was called. It is a gray rectangle. The proportions are right, but the content is nothing but flat light gray.
Comment
Best Answer
Answer by DaveA · Oct 18, 2012 at 10:57 PM
I assume you've seen this: http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.ReadPixels.html
Do you ever call 'Apply' as in setupScript.screenshot.Apply() ?