Search Unity

Camera on to Texture?

Discussion in 'Scripting' started by Steelshot, Feb 13, 2016.

  1. Steelshot

    Steelshot

    Joined:
    Feb 24, 2015
    Posts:
    102
    Hello,

    I am making a game that is based on a mental hospital, you are the person in charge of watching the cameras to make sure the people inside the hospital are safe.

    Picture of TVs for Cameras: (Prototype)

    Cameras.PNG

    I am trying to make the view output of each camera on to each of the boxes (6)

    Could anyone help me with this?

    Thanks!
     

    Attached Files:

  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
  3. Steelshot

    Steelshot

    Joined:
    Feb 24, 2015
    Posts:
    102
    Hello

    I think you misunderstood me, I am asking if there was a way I could drag and
    drop the camera on to the game object and make the game object texture the camera render.

    How do I do that?
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    yes, there is instructions for that in the render texture page:

    Example
    A very quick way to make a live arena-camera in your game:

    1. Create a new Render Texture asset using Assets->Create->Render Texture.
    2. Create a new Camera using GameObject > Create General > Camera.
    3. Assign the Render Texture to the Target Texture of the new Camera.
    4. Create a wide, tall and thin box
    5. Drag the Render Texture onto it to create a Material that uses the render texture.
    6. Enter Play Mode, and observe that the box’s texture is updated in real-time based on the new Camera’s output.

    result is like here:
    http://unitycoder.com/blog/2015/04/25/creating-car-mirror-with-rendertexture/
     
    RavenMikal, aer0ace and Kiwasi like this.
  5. Steelshot

    Steelshot

    Joined:
    Feb 24, 2015
    Posts:
    102
    Thank you so much for the instructions!

    I never knew it was that easy!

    Now, time to save the scene and move on!