两个Camera相距6cm左右,分别渲染到两个1024*1024的RenderTexture上,然后在GUI上分别绘制出来。
using UnityEngine;
using System.Collections;public class UI3D : MonoBehaviour
{public RenderTexture texCamLeft;public RenderTexture texCamRight;Rect rectCamLeft;Rect rectCamRight;// Use this for initializationvoid Start(){rectCamLeft = new Rect(0, -Screen.height * 0.25f, Screen.width * 0.5f, Screen.height * 2);rectCamRight = new Rect(Screen.width * 0.5f, -Screen.height * 0.25f, Screen.width * 0.5f, Screen.height * 2);}// Update is called once per framevoid Update(){}void OnGUI(){GUI.depth = 2;GUI.DrawTexture(rectCamLeft, texCamLeft, ScaleMode.StretchToFill, false);GUI.DrawTexture(rectCamRight, texCamRight, ScaleMode.StretchToFill, false);}
}