How would I get Unity to change between scenes when clicking on an object?
Right now I’ve imported the ClickToMove script on a sphere to play around with it, but I want to make it so that when the user clicks on the sphere, he or she is taken to a new scene, where they can choose to replace that sphere with another object, say a cube.
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnMouseOver() {
if(Input.GetMouseButtonUp(KeyCode.Mouse0)){
Application.LoadLevel(sceneToLoad);
}
}
}
this code is untested. all you need to do is make a script with it and add it to the player object (which has a collider)