Search Unity

Rendering Part of Canvas To Secondary Camera using culling

Discussion in 'Scripting' started by The_Devil, Apr 23, 2016.

  1. The_Devil

    The_Devil

    Joined:
    Jun 6, 2015
    Posts:
    36
    My game is made up of elements on the canvas it self as it is 2d game. The user can create a image that consists of three smaller images that they chose from various options provided in the game. I need to save this image (that actually consists of three separate image) as a png on the device. What I have done is created an empty game object(called "FinalImage" for the sake of convenience) with three images as children under it. I have assigned this game object and all its children a separate layer "Player" to them. I then created a second camera and set the culling mask of this camera to "Player" as I dont want the other UI elements and also assigned a render texture to this camera so that i can save it at a later stage. The problem is, with the culling mask set to "Player" , nothing is visible in the camera , even if I change the culling mask to UI, nothing is visible. The canvas is set to "Screen Space - Camera" and is assigned the Main Camera to it. If change this to "World Space", then the canvas elements are visible with culling set to UI, but on changing it to "Player" nothing is visible. I need to canvas to be "Screen Space - Camera". How do I capture only the elements on the "Player" layer and save that as a png ?
    I am using Unity 5.3.2p1.
     
    Last edited: Apr 23, 2016