What am I missing?
if (Input.GetMouseButtonDown (0)) {
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit, 20)) {
if (hit.collider.name == "collider0")
Application.LoadLevel ("level_1");
if (hit.collider.name == "collider1")
Application.LoadLevel ("level_2");
if (hit.collider.name == "collider2")
Application.LoadLevel ("level_3");
}
}
I just want, when I press the “button” the new level to load.