First Person Controller Creation and destruction on runtime

I am trying to add a First Person controller, originally from the standard unity assets, to a project and on runtime disable it on a button click. I tried gameObject.AddComponent but it seems to give me an error. What would be the easiest way to switch from the main camera to First Person controller Camera?

Thanks in advance

Make the Main Camera and First Person Camera. Then in script when you what to switch cameras disable the one you don’t want to use by using:

//To activate Main Camera
mainCameraVariable.SetActive(true);
firstPersonCamera.SetActive(false);

//To activate First Person Camera
mainCameraVariable.SetActive(false);
firstPersonCamera.SetActive(true);

But make sure to replace mainCameraVariable and firstPersonCamera with the variable you are using to control each GameObject.

Hope I helped!