Hello,
I have a problem with the camera layers when switching to another camera.
In my scene I have created 2 cubes and 2 cameras and I have set different layers for each cube, so that camera 1 can only see for example ( the red cube) and camera 2 only sees (the blue cube) however, the issue is when switching from camera 1 to camera 2, there is a millisecond time that camera 2 will see the red cube which is only camera 1 is supposed to see and vice versa. Please find the attached video for more details.
Unity version: 2021.
AC: Latest.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I'm not clear of the scene's layout - are these two cubes next to each other, and is this a case of using the Camera's Culling Mask to affect what it can render?
The MainCamera does not update its own Culling Mask when switching GameCamera - are you using a custom script to transfer its values?
I’m only using a script called “ac culling” on the main camera so that other game cameras can have their own culling mask
I would need to see the script, in that case.
`using UnityEngine;
using AC;
public class AC_CameraCulling : MonoBehaviour
{
//AC main Camera
MainCamera _mainCamera;
}`
This is the script
You might get by with replacing "Update" with "LateUpdate", but it may be better to rewrite it to involve use of the OnSwitchCamera custom event: