Question by
awesomepiaDev · Mar 28 at 06:18 AM ·
camerascreenshot
how do i take a screenshot clearly with camera
https://answers.unity.com/storage/attachments/194538-originpic.png
[Original picture]
https://answers.unity.com/storage/attachments/194539-issuepic.png
[The picture taken in unity]
I took a screenshot with camera in unity but it looks not clear how do i take a screenshot clearly?
this is the code i used in unity
public void ScreenShot(int imgName)
{
RenderTexture activeRenderTexture = RenderTexture.active;
RenderTexture.active = targetCam.targetTexture;
targetCam.Render();
Texture2D image = new Texture2D(targetCam.targetTexture.width, targetCam.targetTexture.height);
_texture = image;
image.ReadPixels(new Rect(0, 0, targetCam.targetTexture.width, targetCam.targetTexture.height), 0, 0);
image.Apply();
RenderTexture.active = activeRenderTexture;
byte[] bytes = image.EncodeToPNG();
}
issuepic.png
(385.8 kB)
originpic.png
(520.1 kB)
Comment
Your answer