Script throwing error Operator '==' cannot be used with a left hand side of type System.Object and right hand side of type Controller

Hello - in my game the player can switch between the first person controller and the third person controller on pressing the space bar.

On hitting a collider however, after three seconds it is switched to the first person controller automatically (without the player pressing space)

I have one script which switches between the controllers, and one script which forces the player into first person.

The problem I’m having is I’m being thrown this errorBCE0051:Operator ‘==’ cannot be used with a left hand side of type ‘System.Object’ and a right hand side of type ‘Controller’

in reference to this line: if(other.tag == “Player” && SwitchCharactersScript.controllerType == ControllerType.ThirdPersonController)

This is the SwitchControllers script:

#pragma strict

var cam01 : GameObject; // first person camera
var cam02 : GameObject; // third person camera
var player01 : GameObject; //first person controller
var player02 : GameObject; //third person controller


public enum ControllerType
{
	FirstPersonController , ThirdPersonController
}

var controllerType : ControllerType;


function Start()
{	
	cam02.active = false;
	player02.active = false;
		
	cam01.active = true;
	player01.active = true;
		
	controllerType = ControllerType.FirstPersonController;
}

function Update()
{
	if(Input.GetKeyDown(KeyCode.Space))
	{
		ToggleCharacterControllerType();
	}
}

public function ToggleCharacterControllerType()
{
	
	if(controllerType == ControllerType.FirstPersonController)
	{
	
		player02.transform.position = player01.transform.position;
		player02.transform.rotation = player01.transform.rotation;
		
		cam01.active = false;
		player01.active = false;
		
		cam02.active = true;
		player02.active = true;

		controllerType = ControllerType.ThirdPersonController;
	}
	else
	{

		player01.transform.position = player02.transform.position;
		player01.transform.rotation = player02.transform.rotation;
		
		cam02.active = false;
		player02.active = false;
		
		cam01.active = true;
		player01.active = true;
		
		controllerType = ControllerType.FirstPersonController;
	}
}

And this is the ForceIntoFirstPerson script (which is throwing the error):

var SwitchCharactersScript : SwitchCharacters;

function OnTriggerEnter(other : Collider)
{
	if(other.tag == "Player" && SwitchCharactersScript.controllerType == ControllerType.ThirdPersonController)
	{
		yield WaitForSeconds(3.0);
		SwitchCharactersScript.ToggleCharacterControllerType();
	}
}

If anyone could help, it would be so much appreciated!

Thanks, Laurien

I think it could help:

where you write
ControllerType.ThirdPersonController
you should write
SwitchControllers.ControllerType.ThirdPersonController