Would this be possible, Like in lots of games when a flash bang or smiler goes off, you have a overlay of what the camera was showing when it went off for a few seconds.
I basically want to create the same thing, All of it is simple apart from getting a texture of the camera view.
Two simple methods to get a texture of the camera view.
Hello, here my solution after some research
private Texture2D RTImage()
{
Rect rect = new Rect(0, 0, mWidth, mHeight);
RenderTexture renderTexture = new RenderTexture(mWidth, mHeight, 24);
Texture2D screenShot = new Texture2D(mWidth, mHeight, TextureFormat.RGBA32, false);
mCamera.targetTexture = renderTexture;
mCamera.Render();
RenderTexture.active = renderTexture;
screenShot.ReadPixels(rect, 0, 0);
mCamera.targetTexture = null;
RenderTexture.active = null;
Destroy(renderTexture);
renderTexture = null;
return screenShot;
}
Don’t forget to Destroy() your Texture2D after using it.
after screenShot.ReadPixels you MUST add screenShot.Apply()!!!