worked before

I try to create a simple shooting action:

var bulletPrefab : Transform;

var spawnPoint : Transform;
function Update ()
{
if (Input.GetKeyDown(“i”))
{
var bullet = Instantiate(bulletPrefab, spawnPoint.transform.position, transform.rotatin);
bullet.Rigidbody.AddForce(transform.forward * 3000);
}
}

This code worked perfect before but now I get this error: NullReferenceException: Object reference not set to an instance of an object.

Where is the problem? I didn’t used unity for a long time so I think I forgot somthing in my code…

Sorry for poor english.

I think your problem is on the line where is says : var bullet = Instantiate(bulletPrefab,spawnPoint.transform.position, transform.rotation);

First of all you have a spelling mistake, it should be rotation in stead of rotatin.

Then you have to choices , do you want the rotation of the bullet to be equal to the rotation of the gameobject where the script is attached to?

Or the rotation of the gameobject named spawnpoint?

In the first case use this script:

var bulletPrefab : Transform;
var spawnPoint : Transform;
function Update ()
{

    if (Input.GetKeyDown("i"))
    {
    var bullet = Instantiate(bulletPrefab, spawnPoint.transform.position, Quaternion.identity);
 bullet.Rigidbody.AddForce(transform.forward * 3000);
    } 
    }

And second case just add the word spawnpoint with a dot before transform.rotation