I know that Unity changed how mobile screen grabbing works in Unity 3.5 (i think) so that if you want to grab the screen it has to basically be done after a camera is done rendering or at the end of the frame. But here’s what I want to do:
- Draw something to the screen
- Grab that or a portion of it into a texture
- Fill the screen with different content based on that texture which was grabbed
- Flip the buffer into view
All this needs to occur in one frame not spanned across frames. I’m using Unity Free version otherwise I’d use rendertextures.
One strategy I can think of is:
- Disable all cameras
- Use a first camera which renders stuff to the backbuffer, trigger it
manuallyto render (is that possible in Unity Free?) - In that camera’s OnPostRender() (or other way to detect it’s done?) grab a copy of the backbuffer into a texture (I don’t need to offload it to the cpu or change it with setpixels or anything - step 2 already modified it with the gpu)
- Use a second camera which now renders a screen full of pixels based off the texture which was just grabbed, trigger that camera manually to render as a second pass.
Will this work within a single frame? Especially, will this work on mobile which has this caveat about grabbing after the camera is drawn? It almost sounds like you can’t use what you grabbed until the next frame but I hope that just means you have to let A camera finish first before you can grab from it? And then you can render more stuff after?