I'm using Unity 2020.3.21f1, Universal Render Pipeline
Hi, I'm new to this, I'm adding a second camera to my scene through using 'Don't Destroy on load'
The Previous scene (Scene1) Has this:
void Start()
{
SceneManager.LoadSceneAsync(LoadingData.sceneToLoad);
//Static script called
}
And the menu and camera items in this scene have this attached:
void Start()
{
DontDestroyOnLoad(gameObject);
}
So when Scene2 loads, there will be a main camera, and Scene1's Camera. However, in the game mode, when I rollover the (Scene2) main camera's stack, it says it cannot detect an overlay camera, even though the Scene1's overlay camera is in the Scene2 Hierarchy?
When I manually copy over the Scene1 Overlay camera to Scene2, the stack can detect it, and everything works perfect. It is only when using don't destroy on load that it cannot detect a camera?
This might be unrelated, but I am trying to use:
public void CheckForCamera()
{
var cameraData = GetComponent<Camera>().GetUniversalAdditionalCameraData();
cameraData.cameraStack.Add(OverlayCamera);
}
To add the camera, but even with this, when I roll over the main camera stack, it says overlay camera cannot be detected, so I'm guessing I need to figure out why it can't be detected first before this script can be tested.
I have also made sure their tags are different. Scene1 Camera has the tag 'HUDCamera' and Scene2 Main Camera has the tag main camera
Scene1 Camera (HUD Menu Script contains just don't destroy on load): Scene 1 Camera Inspector Details Scene2 Camera (Camera Controller Script follows player around) Scene2 Camera Inspector Details
I've been stuck on this for ages, someone please help!