Bullet Prefab Null reference?

I am trying to make a first person shooting game which my character shoots my bullet Prefab, however, it can’t shoot out anything when I press space bar and unity said it was a null reference Exception error. I don’t know what to do as a newbie and here below is my code and what should I do?

function Update ()

var controller : CharacterController = GetComponent(CharacterController);

// rotate around y - axis 

      transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);
// Move forward / backward
  var forward = transform.TransformDirection(Vector3.forward);
  var curSpeed = speed * Input.GetAxis("Vertical");
  controller.SimpleMove(forward * curSpeed);
  var bullit = Instantiate(bullitPrefab, GameObject.Find("spawnPoint").transform.position, Quaternion.identity);
  bullit.rigidbody.AddForce(transform.forward *2000); 

Looking at your code, the most likely problem is here:


This is likely failing to find the specific game object. Any chance it is named “SpawnPoint” or “Spawnpoint” or “spawnpoint”? Do you have the name mixed up with the tag?