So I want to make a camera trigger...

I’m trying to make a trigger that disables a camera and enables another.

Here’s my code:
using UnityEngine;
using System.Collections;

public class TriggerCameraChange : MonoBehaviour {
	public GameObject oldCamera;
	public GameObject newCamera;

	void Start () {
		oldCamera.gameObject.active = true;
		newCamera.gameObject.active = false;
	}

	void onCollisionEnter(Collider target) {
		if (target.tag == "Player") {
			oldCamera.gameObject.active = false;
			newCamera.gameObject.active = true;
		}
	}

	void onCollisionExit(Collider target) {
		if (target.tag == "Player") {
			oldCamera.gameObject.active = true;
			newCamera.gameObject.active = false;
		}
	}
}

Can anyone Help?

Five problems.

First it should be OnCollisionEnter and OnCollisionExit as without the capital it will not work.

Secondly you need to use (Collision target) because (Collider target) is for a trigger and not a collision. It is annoying that neither Unity nor Visual Studio flag these as errors when they prevent it working.

Third issue is that the tag is on the gameObject not the collider so you will need to use if (target.gameObject.tag == "Player") { instead. It will show you this error when you change Collider to Collision anyway.

Fourth (minor) issue is that oldCamera and newCamera are already gameObjects so there is no need to use oldCamera.gameObject. It shouldn’t give an error but it can make things confusing.

Last issue is that oldCamera.gameObject.active = true; is obsolete, it should tell you this if you mouse over the text underlined in green. It might still work but you should use oldCamera.SetActive(true); instead.