Changing camera with different culling mask

Hello, I need help with changing camera, I am building a function, that when I hold down or click on a keyboard key (like Tab), the camera changes to the second camera, which contains another set of Culling Mask. I’m using the FIrst Person Controller from the Standard Assets as I’m not very familiar with building FPS movement scripts (Walking, Running, Jumping) yet.

So far I tried attaching another camera to the First Person Controller with the alternate Culling Mask, when I click on the key, the camera changes. But the problem is the movement is having problems, like the horizontal movement for the character is being reversed (pressing left goes to the right and vice versa).

Is there any code to allow the changing of camera but still following the previous camera’s position? Or is there any code to enable or disable culling mask for specific layers?

Thanks in advance

Do one of the following:

  1. Combine layer indices: How to compute camera culling mask via script to show two layers - Questions & Answers - Unity Discussions
  2. (1 << LayerMask.NameToLayer(“YourLayerName1”)) | (1 << LayerMask.NameToLayer(“YourLayerName2”)) | …
  3. Define layerMask variable and set it from inspector (