I have the error “Object reference not set to an instance of an object”. My script:
function Update ()
{
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray))
{
**if(hit.collider.gameObject.tag == ("RecomendedMenu"))
{
RecomendedMenu.renderer.enabled = true;
}
if(hit.collider.gameObject.tag == ("KojiMenu"))
{
KojiMenu.renderer.enabled = true;
}**
}
}
The “tag” parts of my script are the ones that are getting the error. “RecomendedMenu” is the correct tag and the variable “RecomendedMenu” has been declared. What is wrong?
Oh yeah, I forgot to put hit in! Thanks!
– CB-TV