Detection of if a game object had been touched

Hi. I checked the scripting references and I am kind of lost. I want the scene to change when the user taps a game object. How can I do this? Can someone point me to a reference or give me an example? Thanks!

void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == “Goal”) //change goal to tag of object
{
Application.LoadLevel(x); //x = Level Number
}
}

Make sure your goal has a collider on it, and has “trigger” enabled.
I’m fairly new, but this should work! (In C#)

Hi Vinnya,

If you want to change scene on tap,menas when player intract with scene and touched on particular object. you want change a scene, if yes…

you need to collider on that partiular object with a TAG
now in any script file create a ray cast using camera.ScreenPointToRay and need to check where it hit’s, if it hits your object then call Application.LoadLevel(); method

private Ray ray;
private RaycastHit hit;
void Update() {
	ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	if(Physics.Raycast(ray, out hit, 100)) {
		string coltag = hit.collider.tag;
		if(coltag == "<<ObjcetTag you applied to your gameobject>>") {
			Application.LoadLevel("Your New Level to Load");
		}
	}
}

Use this example code