So I get “NullReferenceException: Object reference not set to an instance of an object” at this line camera3rd.enabled=false;
. Can’t figure out what’s wrong
using UnityEngine;
using System.Collections;
public class CameraSwitch : MonoBehaviour {
public SmoothFollow camera3rd;
public Transform target;
public float time;
void Start () {
// Auto setup smoothfollow to a cameraswitch script
camera3rd = gameObject.GetComponent<SmoothFollow>() ;
//disabling this script
camera3rd.enabled=false;
}