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
thank you