MonoBehaviour.OnMouseUpAsButton 当鼠标作为按钮弹起时

function OnMouseUpAsButton () : void

Description描述

OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed.

OnMouseUpAsButton只有当鼠标在同一个GUIElementCollider按下,在释放时调用。

参见:OnMouseUp.

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void OnMouseUpAsButton() {

		Application.LoadLevel("SomeLevel");

	}

}
// Loads the level named "SomeLevel" as a response

// to the user clicking on the object

//当用户在物体上点击,加载名为SomeLevel的关卡

function OnMouseUpAsButton () {

	Application.LoadLevel ("SomeLevel");

}

This function is not called on objects that belong to Ignore Raycast layer.

当物体属于忽略“光线投射”层,此函数不会调用。

OnMouseUpAsButton can be a co-routine, simply use the yield statement in the function. This event is sent to all scripts attached to the Collider or GUIElement.

OnMouseUpAsButton可以协同程序,简单实用yield语句。这个事件发送到附加到ColliderGUIElement的所有脚本。

IMPORTANT: This function has no effect on iPhone.

注意:此函数在iPhone上无效。

Page last updated: 2011-9-16