Welcome to the Treehouse Community
Looking to learn something new?
The code works but an error keeps populating in the console
So the code works and my cameras switch and fade in and out but I keep getting one of these errors thrown per second in the console:
NullReferenceException: Object reference not set to an instance of an object CameraManager.SwitchCamera (Int32 cameraIndex) (at Assets/Scripts/CameraManager.cs:54) CameraManager.Update () (at Assets/Scripts/CameraManager.cs:37)
I can't seem to suss out what it is since as far as I can tell I have the exact same code as Clint in the video. Any ideas?
Nick PettitTreehouse Teacher
Typically this means that there's a missing reference in the Inspector. For example, in the CameraManager component, there's probably an Inspector field that's blank, or doesn't have the right value. Hopefully that makes sense! If you're still having trouble, upload a zip file of your project and paste the link here, I'm happy to take a look.
All the best, Nick