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上无效。

最后修改:2011年9月16日 Friday 20:22

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。