OK I’m using this method here for switching cameras from one UI canvas to another.
Switching Cameras method UI C#
Only when I switch to the 2nd camera on the 2nd canvas I get this:
OK I’m using this method here for switching cameras from one UI canvas to another.
Switching Cameras method UI C#
Only when I switch to the 2nd camera on the 2nd canvas I get this:
Check if the “Viewport Rect” of your Camera is setup correctly:
X:0 Y:0
W:1 H:1
It didn’t work for me! I could not fix it in any way…
I ended up setting up the main camera’s transform position and rotation to the “camera i wanted to switch to”'s position and rotation
void Start () {
// ...
_originalCameraRotation = _mainCamera.transform.rotation;
_originalCameraPosition = _mainCamera.transform.position;
// ...
}
void SwitchToCamera(Camera c) {
_mainCamera.transform.position = c.transform.position;
_mainCamera.transform.rotation = c.transform.rotation;
}
void ReturnToMainCamera () {
_mainCamera.transform.position = _originalCameraPosition;
_mainCamera.transform.rotation= _originalCameraRotation;
}