second camera question

I made a second camera view for the inside view of my tank ( port hole type of view)
and got it to work fine. My question is how can i make a dashboard texture and have the camera view thru that.

thanks

wayne

You can use a GUITexture - it is drawn in the GUILayer, in front of the camera. Draw the texture in some image editor (Photoshop is good - Unity reads PSD files directly), import to Assets, select it and click Create/GUITexture in the Project panel.

EDITED: After some tests, I found that GUITexture is very hard to adjust to a second camera. Fortunately, Unity has a good alternative: GUI.DrawTexture. This function draws over all cameras, and can easily be adjusted to any camera rect and screen resolution.

Attach the script below to the second camera, and the texture you’ve drawn to the variable texture: the script adjusts the texture to the camera rect and screen size automatically.

var texture: Texture; // drag your texture here

function OnGUI(){
    var rect = camera.pixelRect; // rect.y is relative to screen bottom
    rect.y = Screen.height-rect.y-rect.height; // let y relative to the top
    var aspect = rect.width/rect.height; // calculate aspect
    GUI.DrawTexture(rect, texture, ScaleMode.ScaleToFit, true, aspect);
}