Version: 2018.4

説明

OnMouseUp はユーザーがマウスボタンを離したときに呼び出されます

OnMouseUp はマウスを押した時と同じ GUIElementCollider 上にない場合でも呼び出されることに注意してください。 ボタンのような動作は OnMouseUpAsButton を参照してください。

// Register when mouse dragging has ended. OnMouseUp is called
// when the mouse button is released.

using UnityEngine;

public class ExampleClass : MonoBehaviour { void OnMouseUp() { // If your mouse hovers over the GameObject with the script attached, output this message Debug.Log("Drag ended!"); } }

この関数はレイヤーが「 Ignore Raycast 」のゲームオブジェクトでは呼び出されません。

This function is called on Colliders marked as Trigger if and only if Physics.queriesHitTriggers is true.

OnMouseUp 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.

See Also: OnMouseDown, OnMouseDrag.