Error : Object Reference not set to an instance of an object

It keeps popping up when ever the timer is 0 , or a gameobject that is tag with vehicle gets hit by the main player.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class MoveScript : MonoBehaviour {
Text timeleft;
Text Illegal;
Text beating;
Text unloading;
int numillegal;
int numbeating;
int numunloading;
float numtimeleft;
public GameObject timelefttext;
public GameObject ilegaltext;
public GameObject beatingtheredlight;
public GameObject unloadingloading;

public AudioClip whistle;
public AudioClip xsound;
public AudioClip gameover;

void Start(){
GameObject.Find (“quit game button”).SetActive (false);
GameObject.Find (“playagain button”).SetActive (false);
GameObject.Find (“you won”).SetActive (false);

numtimeleft = 30;
timelefttext = GameObject.Find(“Timer”);
timeleft = timelefttext.GetComponent();

numillegal = 7;

ilegaltext=GameObject.Find (“Illegal Parking”);
Illegal = ilegaltext.GetComponent();

numbeating = 5;
beatingtheredlight=GameObject.Find (“Beating The Red Light”);
beating = beatingtheredlight.GetComponent();

numunloading = 3;
unloadingloading = GameObject.Find(“Unloading and Loading”);
unloading = unloadingloading.GetComponent();

}

void Update () {

if (Input.touchCount == 1) {
Touch touch = Input.GetTouch (0);

float x = -7.5f + 15 * touch.position.x / Screen.width;
float y = -4.5f + 9 * touch.position.y / Screen.height;

transform.position = new Vector3 (x, y);
}

/-----------------------------------------------------------------------/

if (numtimeleft <= 0f) {
GameObject.Find(“Main Camera”).audio.volume = 0;
AudioSource.PlayClipAtPoint(gameover,transform.position);
Time.timeScale = 0;
GameObject.Find (“quit game button”).SetActive(true);
GameObject.Find (“playagain button”).SetActive(true);

}
timeleft.text = numtimeleft.ToString (“0”);
numtimeleft -= Time.deltaTime;

Illegal.text = numillegal.ToString (“”);
beating.text = numbeating.ToString (“”);
unloading.text = numunloading.ToString (“”);

if (numillegal == 0 && numbeating == 0) {
if (numunloading == 0) {
Time.timeScale = 0;
GameObject.Find (“quit game button”).SetActive(true);
GameObject.Find (“playagain button”).SetActive(true);
GameObject.Find (“you won”).SetActive(true);

}
}

}

void OnCollisionEnter2D ( Collision2D coll ){
if (coll.gameObject.tag == “IllegalParking”) {

numillegal -= 1;
Destroy (coll.gameObject);
AudioSource.PlayClipAtPoint(whistle,transform.position);

}
else if (coll.gameObject.tag == “BeatingTheRedLight”) {

numbeating -= 1;
Destroy (coll.gameObject);
AudioSource.PlayClipAtPoint(whistle,transform.position);
} else if (coll.gameObject.tag == “UnloadingLoading”) {

numunloading -=1;
Destroy (coll.gameObject);
AudioSource.PlayClipAtPoint(whistle,transform.position);
}
else if (coll.gameObject.tag == “Vehicles”)
{

GameObject.Find (“quit game button”).SetActive(true);
GameObject.Find (“playagain button”).SetActive(true);
GameObject.Find(“Main Camera”).audio.volume = 0;


AudioSource.PlayClipAtPoint(xsound,transform.position);
Time.timeScale = 0;

}
}

}

For performance never use GameObject.Find in Update
use at Awake() or Start()

see documentation

sir akenaton how to find inactive gameobjects? :frowning:

if(!gameObject.activeSelf)
{
      gameObject.SetActive(true);
}

just declare it as a public GameObject and drag it into the inspector.