お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseOnMouseUpAsButtonはマウスを押した時と同じGUIElementやCollider上でマウスを離した時のみに呼び出されます。
See Also: OnMouseUp.
// 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 ExampleClass : MonoBehaviour { void OnMouseUpAsButton() { Application.LoadLevel("SomeLevel"); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def OnMouseUpAsButton() as void: Application.LoadLevel('SomeLevel')
この関数はレイヤーが「Ignore Raycast」のゲームオブジェクトでは呼び出されません。 OnMouseUpAsButtonは関数の中にシンプルなyield文を使用して、コルーチンにすることができます。 このイベントはColliderまたはGUIElementにアタッチされているすべてのスクリプトに送信されます。