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

Show what camera sees in the box.

Discussion in 'Scripting' started by Temp10101, Apr 13, 2015.

  1. Temp10101

    Temp10101

    Joined:
    Feb 11, 2015
    Posts:
    54
    I kinda need to show minimap, except I found out it just can be plainly dropdown camera couple hundreds miles in the air. But I was wondering, whether I could place camera there and show what it sees in a minified box.
     
  2. ThomasCreate

    ThomasCreate

    Joined:
    Feb 23, 2015
    Posts:
    81
    Temp10101 likes this.
  3. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    You can also achieve that with the "viewport rect" parameter of the camera, you just have to make a little script that controls camera size(i guess it'll be ortho..) & viewport based on screen size
     
    ThomasCreate likes this.
  4. Temp10101

    Temp10101

    Joined:
    Feb 11, 2015
    Posts:
    54
    Following steps are executed:
    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.

    I get stuck at step 5, I can't drag in into inspector, I can't drop it on the box in Editor, I can't drop it anywhere. I do have ready renderer.
     
  5. Temp10101

    Temp10101

    Joined:
    Feb 11, 2015
    Posts:
    54
    Apparently of all random UI types, it required RawImage. Thank you.