0
\$\begingroup\$

I'm working on a project that has multi screen to show environment. the question is options not working when there is multi screen. for example in single screen you can set which screen shows the game but it seems there is not such option.

how can I set which display or which camera get displayed on which monitor in script? for example: camera display 1 to screen 2 and....?

thank you for helping

\$\endgroup\$
1
\$\begingroup\$

You can set the target display of any camera with the TargetDisplay propriety of the Camera component.

Via Inspector:

enter image description here

Via Script:

Camera camera;

void Awake() {
    camera = GetComponent<Camera>();
}

void CameraTargetDisplay (int target) {
    camera.targetDisplay = target;
}

target is equal to the display index in the Display.displays array.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.