variable has not been assigned

all im trying to make here is a shoot instance from the camera when you hit space but for some reason i cant figure out my first line is wrong some how… idk what im doing wrong i hit space and i get a warning message at the bottom of the screen “unassigned reference exception:the variable prefabBullet of ‘simpleshoot’ has not been assigned” but i have assigned my prefab, prefabBullet…what am i doing wrong?

var prefabBullet: Transform = prefabBullet;

var shootForce: float = 1000;

function Update () {


	var instanceBullet = Instantiate (prefabBullet, transform.position, Quaternion.identity);


The error occurs because of the wording of that line-

var prefabBullet: Transform = prefabBullet;

The problem here is that it will always try to assign itself to itself, but if it is null then it can never be anything other than null! Just change that line to

var prefabBullet: Transform;

and you shouldn’t have a problem.

I found that I was still getting errors when I didvar prefabBullet: Transform;. To solve those errors, I needed to go to the inspector window and drag an object into the prefabBullet spot.