Unassigned Reference Exception

I have been getting this error when I try to run my code for switching cameras. I don’t understand why it is telling my that the variables are null, as I have other variables assigned similarly.

“UnassignedReferenceException: The variable CutSceneCam of ‘UponCollision’ has not been assigned.
You probably need to assign the CutSceneCam variable of the UponCollision script in the inspector.”

Here is the code that I am using:

public class UponCollision : MonoBehaviour {
	public Camera CutSceneCam;
	public Camera MainCamera;
	void Start (){
	    CutSceneCam.enabled = true;
	    MainCamera.enabled = false;
	void OnTriggerEnter(Collider col){
	    if (col.gameObject.name == "CutSceneCam") {
	        CutSceneCam.enabled = !CutSceneCam.enabled;
	        MainCamera.enabled = !MainCamera.enabled;

Another problem has presented itself. The code now works, the animation works, but when the camera colides with the trigger box that I have, it doesn’t switch from the stationary camera to the player camera. The code is the exact same, except for the fact that the object that is supposed to be colliding with the collider has changed several times in experimentation. At the moment, I have a sphere running into a box collider, and this is supposed to switch the cameras, but it doesn’t.

what I have done to rectify this issue was copy my c# script that I coded in Monodevelop
delete the C# file …
re-create the C# file - copy the script back into the C# file again
attach the variable or objects back into the script in the inspector
and the run the project again.

what I remember was that the first time around I ran the scene before I attached the objects to the script. Upon stopping the game then attaching the objects after I realized they were missing I received this error.
I figured Unity held some sort o memory that the objects were missing script so I figured I would make sure everything was in place before I hit the play button/ran the game this time around. Seems to work now. even though I get an error that the second object is now missing.

I have a strange problem that the camera un-assigns itself as soon as I play, when I stop it re-assigns… I have no clue whats happening.

You need to look at this object in Unity and then look to the right where you placed your script file. This area is called the inspector.

There, the script will have two spots for your two public variables - “CutSceneCam” and “MainCamera”.

You need to drag a camera object in to each to assign them.