Adding a border to a minicam

How do you add a GUI border to a minicam (second smaller camera)?

Nothing fancy here, but for a “basic” mini-cam border all I did was add this to the minicamera object →

#pragma strict
@script ExecuteInEditMode
 
var mySkin : GUISkin ;

function OnGUI(){
   if(mySkin)
      GUI.skin = mySkin ;
   var cam : Camera = transform.camera ;
   GUI.Box(Rect(cam.pixelRect.x, (Screen.height - cam.pixelRect.yMax), cam.pixelWidth, cam.pixelHeight), "") ;
}

Then made a gui skin for it, made the box->normal->background a 32x32 image with a transparent background and a 2px wide color-border around the edges.

Should be a decent starting point anyway, and could easily make it a little better with a “good” border image.

In new UI UNITY 5:
Creat a second camera, Add this script:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

// Add componet in 2d camera
[RequireComponent( typeof( Camera ))]
public class scpCameraBorder : MonoBehaviour {
	public Transform puitBorder;
	private Camera gscCam; // 2nd Camera

	//==================================================
	// Use this for initialization
	void Awake () {
		gscCam = gameObject.GetComponent< Camera >();
		gameObject.SetActive( false );
	}

	//==================================================
	//
	void OnEnable() {
		vSetActive( true );
	}

	//==================================================
	//
	void OnDisable() {
		vSetActive( false );
	}

	//=================================================
	// 
	void vSetBorder() {
		// Screen
		Rect rCam2 = gscCam.rect;
		rCam2.width *= Screen.width;
		rCam2.height *= Screen.height;
		rCam2.x *= Screen.width;
		rCam2.y *= Screen.height;
		//Debug.Log( ">> " + rCam2 );
		//
		Image uiimBorder = puitBorder.GetComponent< Image >();
		if( uiimBorder != null ){
			uiimBorder.rectTransform.sizeDelta = new Vector2( rCam2.width, rCam2.height );
			uiimBorder.rectTransform.position = new Vector2( rCam2.x + uiimBorder.rectTransform.sizeDelta.x / 2, rCam2.y + uiimBorder.rectTransform.sizeDelta.y / 2 );
		}
	}

	//====================================================
	//
	public void vSetActive( bool b_Active ){
		kGameParams.pbCam2da = b_Active;
		gscCam.enabled = b_Active;
		puitBorder.gameObject.SetActive( b_Active );
		if( b_Active ){
			vSetBorder();
		}
	}
}