I want to create a script that creates two new cameras, position them by the main camera and the ultimate goal is to have each render to a different screen. I started the script but it gives me some errors. Here is the script.
function Start(){
var camera1 : Camera;
var camera2 : Camera;
var mainCam : Camera = Camera.main;
Instantiate(camera1, transform.position, transform.rotation);
Instantiate(camera2, transform.position, transform.rotation);
camX = mainCam.transform.position.x;
camera1.transform.Translate(Vector3(camX+1,0,0));
camera2.transform.Translate(Vector3(camX-1,0,0));
camera1.transform.parent = mainCam.transform;
camera2.transform.parent = mainCam.transform;
}
(updated code)
I get “cannot convert UnityEngine.GameObject to UnityEngine.Camera”.
Also, is it otherwise correct? This is the only obvious error I get.
Thanks in advance.