Setting target for Camera2DFollow from script at runtime

I have a level manager that is persistent across scenes, that has a public method I can call from a UI button to change to the main menu scene, or to the game scene.

The game scene contains only a camera with a Camera2DFollow component from the standard assets. When the function that generates the level is called, it loads the game scene, uses GameObject.FindObjectOfType() to find the camera and then sets it’s target transform to that of the newly spawned player.

My issue is that the level manager doesn’t seem to find the camera. When I put a Debug.Log just after the line that finds the camera, if tells me the camera doesn’t exist, even though it is constantly spitting out errors saying that it’s target is null.

What is going wrong here?

Hi
Try with:
GameObject.Find(“The name of your camera”);