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