so my problem is this i have every single thing in the debuger working exactly how i want it, but when i actually need to instantiate it it gives me this error:
Object reference not set to an instance of an object
wtf my mean seriously wtf, it should be working can anybody help me out?
var tower1 : GameObject;
var hitPoint : Vector3;
function Update () {
var hit : RaycastHit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if ( Physics.Raycast( ray, hit, 100 ) )
Debug.Log("1st");
if (hit.collider.CompareTag("gridFloor")){
var gridPoint = hit.collider.gameObject.transform.position;
Debug.Log("2nd ");
Debug.Log(gridPoint);
Debug.Log(tower1);
if(Input.GetMouseButtonDown(0)){
Debug.Log("3rd ");
if(gridPoint != null){
Instantiate(tower1,gridPoint,Quaternion.Identity);
Debug.Log("hello");
}
}
}
}