problem creating object

i have button GUI with this script

var buildingToMake:GameObject;
var normalTexture:Texture2D;
var rollOverTexture:Texture2D;


function Update () 
{
	
}

function OnMouseEnter()
{
	guiTexture.texture = rollOverTexture;
}

function OnMouseExit()
{
	guiTexture.texture = normalTexture;
}

function OnMouseUp()
{
	var currentPlayer:GameObject;
	var currentBuilding:GameObject;
	currentBuilding = GameObject.Instantiate(buildingToMake,currentPlayer.transform.position,currentPlayer.transform.rotation);
	currentBuilding.transform.position.z +=2;
}

i want this button to create an object and place it to the area near the player in this case player.z +2 …

i keep getting this error “Object reference not set to an instance of an object”

anyone plss help :frowning: thank you

Drag your building prefab onto the buildingToMake variable in the editor before you run the game?

i’ve done that but i still get the error :frowning:

i dont know what ive done wrong