Reputation: 474
I am taking screenshot using
Texture2D tex = new Texture2D(width,height);
Rect textureRect = new Rect(0,0,width,height);
tex.ReadPixels(textureRect,0,0);
tex.Apply();
It works fine. But when I apply an Image Effect on the camera such as blur or bloom provided in Unity Standard Assets the screenshot captured is black. I do not understand why. Can anybody help me on this?
Upvotes: 1
Views: 3191
Reputation: 2720
You should try calling it on OnPostRender()
in any component.
Also you could run your capturing code in: Camera.OnRenderImage(RenderTexture,RenderTexture)
This method is called by Unity3D engine after all rendering is done and we have finall image on screen.
You need to create component for it and attach it to the camera.
http://docs.unity3d.com/ScriptReference/Camera.OnRenderImage.html
Upvotes: 0
Reputation: 1130
Use Application.CaptureScreenshot to take a screenshot.
Application.CaptureScreenshot("Screenshot.png");
If you want to display it ingame, i would recommend using a RenderTexture, which I think is available for free since Unity5.
Upvotes: 1