Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Display image from a camera in a UI component

Discussion in 'UGUI & TextMesh Pro' started by davinc131, Nov 3, 2016.

  1. davinc131

    davinc131

    Joined:
    Jun 23, 2015
    Posts:
    19
    Greetings!
    I have a project in which I have the need to display images from a second camera in a UI component as a panel, for example. The idea is that it works like a screen on a monitor. In the scene will exist the main camera and one or two secondary cameras in the same scene but showing different environments.
    I have been searching the internet for solutions, but so far I have not been successful. How do I achieve this? What tutorials can you tell me to help me solve this problem?
     
  2. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    Just render the secondary camera into a RenderTexture, and then use that RT with a RawImage in your UI.
     
  3. davinc131

    davinc131

    Joined:
    Jun 23, 2015
    Posts:
    19
    worked perfectly. Thank you.
     
    mh114 likes this.
  4. WoodsBagot

    WoodsBagot

    Joined:
    Mar 6, 2014
    Posts:
    8
    Seems like a great approach, but I just added the RT with a RawImage in my UI and get nothing. Has something changed in how Unity approaches this?
     
    reachout likes this.
  5. BeanBandit54

    BeanBandit54

    Joined:
    Mar 17, 2023
    Posts:
    1
    What about just adding a second Game tab, then in the second camera object switch the Target display from Display 1 to Display 2, and switch the second Game tab to show Display 2? This way you get two tabs with two different cameras.