I’m able to change the main camera’s viewport at runtime, and the script is finding Cam2, but I can’t adjust its rect.
The commented out line is the offender.
This script is currently attached to the main camera.
Thanks!
public class P1Cam : MonoBehaviour {
GameObject Cam2;
void Start(){
Cam2 = GameObject.Find ("Cam2");
if (Cam2) {
Debug.Log ("found Cam2");
//Cam2.rect = new Rect (0.5f, 0, 0.5f, 0);
Camera.main.rect = new Rect (0, 0, 0.5f, 1);
} else {
Camera.main.rect = new Rect (0, 0, 1, 1);
}
}
}
Remember to accept helpful answers
– AurimasBlazulionis