OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.
// Loads the level named "SomeLevel" as a response // to the user clicking on the object function OnMouseDown () { Application.LoadLevel ("SomeLevel"); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnMouseDown() { Application.LoadLevel("SomeLevel"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnMouseDown() as void: Application.LoadLevel('SomeLevel')