1
\$\begingroup\$

In my Unity2D game, I'm using a second camera to "screenshot" the current view. I then display this screenshot within the game. This works the first time I take a screenshot. When taking the second screenshot, I expect the first screenshot to show up in the second, creating a screenshot-within-a-screenshot effect. However, this doesn't happen - the previous screenshot doesn't show up in the next.

Here's a more visual description:

Before taking any screenshots:

One gear showing

After taking the first screenshot and displaying it in the bottom-left corner:

Two gears showing

After taking the second screenshot:

Still only two gears showing

Notice that this screenshot looks identical to the previous one. Here's what I expected:

What I expected - recursive gears

It seems like my Canvas/RawImage that is displaying the screenshot isn't being captured by my second camera. Why is this?

Some additional details: my canvas is set to Screen Space - Camera. I'm using Unity 5.6.1f1.

\$\endgroup\$
2
\$\begingroup\$

UPDATE: Upon opening up this test project another day, this seems to be broken once again (even with my Canvas set to World Space). I'm suspecting this might be a bug with Unity, and I've filed a bug report. I'll update this answer once I hear back from Unity.

Previous answer:


Figured it out while posting, but in the spirit of Stack Exchange, I'll post my question with the solution. I just had to switch my Canvas's render mode to World Space:

Recursive gears

\$\endgroup\$
  • \$\begingroup\$ A canvas in "overlay space" always renders last, bypassing any render texture stuff. I'm not sure where "screen space" is in the render order, but yes, "world space" is likely the only one that would be captured to the texture. \$\endgroup\$ – Draco18s Jun 25 '17 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.