- Home /
Second camera does not show UI Image element (but does show sprite)
I am working on a 2D board game similar to WordFeud: a gameboard with tiles (UI Image prefabs generated with code), with underneath the board a user interface with tiles, buttons, scores etc. I want to zoom in on the game board by double tap on the screen. The game scales with the device resolution using the canvas scaler option as demonstrated here: Charger Games. For the zoom I have added a second camera that renders its output to a render texture as explained here: Gamasutra. The render texture will eventually take the position of the game board. Here it is a bit smaller than the full board to show what's happening.
In the trial setup I am able to perform the zoom with the second camera on a sprite (dragged to the scene) but the second camera fails to render a UI Image element if added to the scene. Yet this is what my game is composed of: UI Image elements.
Question: how do I get the second camera to show UI Image elements on the render texture?
Below some screen dumps of the set-up. First: the main canvas with the scaler enabled: The UI Image - game board, is used as a background image, a place holder. Next screen shows the second camera set-up:
I am not allowed to add more screens, but the sprite "WordFeud sprite" is properly rendered on the render texture (as can be seen in the examples), but the UI Image "UI image test" is not rendered. It is also not shown in either camera preview.
Is does not matter if I put the sprite or the UI Image in the default layer or the UI layer, the result in both cases is the same: the sprite is rendered, the UI Image is not.
Unity version 5.3.3.f1