in my game i have 4 scene ,one of them is may mainmenu i have some keys in this scene so i write a code that is=
if (Input.touchCount > 0)
{
var ray = Camera.main.ScreenPointToRay (Input.GetTouch(0).position);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit))
{
Debug.Log(" You just hit " + hit.collider.gameObject.name);
if(hit.collider.tag == "newGame")
{
Application.LoadLevel(2);
}
if(hit.collider.tag == "guide")
{
Application.LoadLevel(5);
}
if(hit.collider.tag == "aboutme")
{
Application.LoadLevel(4);
}
}
}
to use touche and it work very well in my mainMenu but when i write this code for my another scene it not working and always it get Eror that is =Objetc reference not set to an instance of an object)
and if i had some mistakes in may question its for that i cant write english well
please help me..i realy need this
↧